Skip to content

Commit

Permalink
Merge branch '8.x' into markjhoy/add_enterprise_search_deprecation_ca…
Browse files Browse the repository at this point in the history
…llouts
  • Loading branch information
markjhoy authored Sep 29, 2024
2 parents b469697 + 3f3c093 commit 85d10b7
Show file tree
Hide file tree
Showing 73 changed files with 1,168 additions and 319 deletions.
Binary file modified docs/user/alerting/images/es-query-rule-action-query-matched.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/user/alerting/images/es-query-rule-action-summary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/user/alerting/images/es-query-rule-action-variables.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/user/alerting/rule-types/es-query.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ For example:
If you use {kibana-ref}/kuery-query.html[KQL] or {kibana-ref}/lucene-query.html[Lucene], you must specify a data view then define a text-based query.
For example, `http.request.referrer: "https://example.com"`.

preview:["Do not use {esql} on production environments. This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features."] If you use {ref}/esql.html[ES|QL], you must provide a source command followed by an optional series of processing commands, separated by pipe characters (|).
If you use {ref}/esql.html[ES|QL], you must provide a source command followed by an optional series of processing commands, separated by pipe characters (|). added:[8.16.0]
For example:

[source,sh]
Expand Down Expand Up @@ -101,7 +101,7 @@ For example:
image::user/alerting/images/rule-types-es-query-valid.png[Test {es} query returns number of matches when valid]
// NOTE: This is an autogenerated screenshot. Do not edit it directly.

preview:[] If you use an ES|QL query, a table is displayed. For example:
If you use an ES|QL query, a table is displayed. For example:

[role="screenshot"]
image::user/alerting/images/rule-types-esql-query-valid.png[Test ES|QL query returns a table when valid]
Expand Down
41 changes: 29 additions & 12 deletions docs/user/dashboard/create-dashboards.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,44 @@ TIP: If you don't have data at hand and still want to explore dashboards, you ca

//To make your dashboard experience as good as possible for you and users who will view it, check the <<dashboard-best-practices,dashboard best practices>>.

. Open the *Dashboard* page in {kib}.
. Open the *Dashboards* page in {kib}.

. Select *Create dashboard* to start with an empty dashboard.
+
When you create a dashboard, you are automatically in edit mode and can make changes to the dashboard.
[[create-panels-with-lens]]
. Add content to the dashboard. You have several options covered in more details in the <<panels-editors,Visualizations section>>:
. Add content to the dashboard. You have several options covered in more detail in the <<panels-editors,Visualizations section>>:
** <<lens,**Create visualization**>>. This option is a shortcut to create a chart using **Lens**, the default visualization editor in {kib}.
** <<panels-editors,**Add panel**>>. Choose one of the available panels to add and configure content to your dashboard.
** **Add from library**. Select existing content that has already been configured and saved to the **Visualize Library**.
** <<add-controls,**Controls**>>. Add controls to help filter the content of your dashboard.

+
[role="screenshot"]
image::images/add_content_to_dashboard_8.15.0.png[Options to add content to your dashboard, width=70%]
. Organize your dashboard by <<arrange-panels,organizing the various panels>>.
[[add-dashboard-settings]]
. Define the main settings of your dashboard from the *Settings* menu located in the toolbar.
.. Meaningful title, description, and <<managing-tags,tags>> allow you to find the dashboard quickly later when browsing your list of dashboard or using the {kib} search bar.
.. A meaningful title, description, and <<managing-tags,tags>> allow you to find the dashboard quickly later when browsing your list of dashboards or using the {kib} search bar.
.. Additional display options allow you unify the look and feel of the dashboard's panels:

*** *Store time with dashboard* &mdash; Saves the specified time filter.
*** *Use margins between panels* &mdash; Adds a margin of space between each panel.
*** *Show panel titles* &mdash; Displays the titles in the panel headers.
*** *Sync color palettes across panels* &mdash; Applies the same color palette to all panels on the dashboard.
*** *Sync cursor across panels* &mdash; When you hover your cursor over a time series chart or a heatmap, the cursor on all other related dashboard charts automatically appears.
*** *Sync tooltips across panels* &mdash; When you hover your cursor over a *Lens* chart, the tooltips on all other related dashboard charts automatically appears.
*** *Sync tooltips across panels* &mdash; When you hover your cursor over a *Lens* chart, the tooltips on all other related dashboard charts automatically appear.

.. Click *Apply*.
.. Click *Apply*.
+
[role="screenshot"]
image::https://images.contentstack.io/v3/assets/bltefdd0b53724fa2ce/blt532d6c9ca72817d6/66f31b1f80b55f3a20e1a329/dashboard_settings_8.15.0.gif[Change and apply dashboard settings, width 30%]

. **Save** Save the dashboard.
. Click **Save** to save the dashboard.

[[open-the-dashboard]]
== Edit a dashboard

. Open the *Dashboard* page in {kib}.
. Open the *Dashboards* page in {kib}.

. Locate the dashboard you want to edit.
+
Expand All @@ -67,7 +72,9 @@ TIP: When looking for a specific dashboard, you can filter them by tag or by cre
. Click the dashboard *Title* you want to open.

. Make sure that you are in **Edit** mode to be able to make changes to the dashboard. You can switch between **Edit** and **View** modes from the toolbar.

+
[role="screenshot"]
image::https://images.contentstack.io/v3/assets/bltefdd0b53724fa2ce/bltf75cdb828cef8b5a/66f5cfcfad4f59f38b73ba64/switch-to-view-mode-8.15.0.gif[Switch between Edit and View modes, width 30%]
. Make the changes that you need to the dashboard:

** Adjust the dashboard's settings
Expand All @@ -86,7 +93,11 @@ NOTE: Once changes are saved, you can no longer revert them in one click, and in

. In the toolbar, click *Reset*.

. On the *Reset dashboard* window, click *Reset dashboard*.
. On the *Reset dashboard?* window, click *Reset dashboard*.

+
[role="screenshot"]
image::https://images.contentstack.io/v3/assets/bltefdd0b53724fa2ce/bltcd3dbda9caf48a9b/66f4957fc9f9c71ce7533774/reset-dashboard-8.15.0.gif[Reset dashboard to revert unsaved changes, width 30%]

include::dashboard-controls.asciidoc[leveloffset=-1]

Expand All @@ -108,7 +119,7 @@ In the toolbar, click *Edit*, then use the following options:

* To resize, click the resize control, then drag to the new dimensions.

* To maximize to full screen, open the panel menu, then click *More > Maximize panel*.
* To maximize to full screen, open the panel menu, then click *More > Maximize*.
+
TIP: If you <<share-the-dashboard,share>> a dashboard while viewing a full screen panel, the generated link will directly open the same panel in full screen mode.

Expand All @@ -126,7 +137,10 @@ Duplicated panels appear next to the original panel, and move the other panels t

. In the toolbar, click *Edit*.

. Open the panel menu, then select *Duplicate panel*.
. Open the panel menu, then select *Duplicate*.
+
[role="screenshot"]
image::images/duplicate-panels-8.15.0.png[Duplicate a panel, width=50%]

[float]
[[copy-to-dashboard]]
Expand All @@ -137,6 +151,9 @@ Copy panels from one dashboard to another dashboard.
. Open the panel menu, then select *More > Copy to dashboard*.

. On the *Copy to dashboard* window, select the dashboard, then click *Copy and go to dashboard*.
+
[role="screenshot"]
image:https://images.contentstack.io/v3/assets/bltefdd0b53724fa2ce/blt64206db263cf5514/66f49286833cffb09bebd18d/copy-to-dashboard-8.15.0.gif[Copy a panel to another dashboard, width 30%]

== Import dashboards

Expand Down
23 changes: 16 additions & 7 deletions docs/user/dashboard/dashboard-controls.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ To add interactive Options list and Range slider controls, create the controls,

. Open or create a new dashboard.

. Make sure you are in *Edit* mode, and select *Controls* > *Add control* in the dashboard toolbar.
. In *Edit* mode, select *Controls* > *Add control* in the dashboard toolbar.
+
[role="screenshot"]
image::images/dashboard-add-control-8.15.0.png[Controls button in the toolbar with the Add Control option selected, width=60%]

. From the *Data view* dropdown, select the data view that contains the field you want to use for the *Control*.
. On the *Create control* flyout, from the *Data view* dropdown, select the data view that contains the field you want to use for the *Control*.

. In the *Field* list, select the field you want to filter on.

Expand Down Expand Up @@ -80,7 +83,10 @@ You can add one interactive time slider control to a dashboard.

. Open or create a new dashboard.

. In the dashboard toolbar, click *Controls* > *Add time slider control*.
. In *Edit* mode, select *Controls* > *Add time slider control*.
+
[role="screenshot"]
image::images/dashboard-add-time-slider-control-8.15.0.png[Controls button in the toolbar with the Add a time slider option selected, width=60%]

. The time slider control uses the time range from the global time filter. To change the time range in the time slider control, <<set-time-filter,change the global time filter>>.

Expand All @@ -92,11 +98,14 @@ You can add one interactive time slider control to a dashboard.
[[configure-controls-settings]]
==== Configure the controls settings

Several settings that apply to all controls of a same dashboard are available.
Several settings that apply to all controls of the same dashboard are available.

. In the dashboard toolbar, click *Controls*, then select *Settings*.
. In *Edit* mode, select *Controls* > *Settings*.
+
[role="screenshot"]
image::images/dashboard-controls-settings-8.15.0.png[Controls button in the toolbar with the Settings option selected, width=60%]

. On the *Control settings* flyout, configure the settings:
. On the *Control settings* flyout, configure the following settings:

* *Label position* &mdash; Specify where the control label appears.

Expand All @@ -105,7 +114,7 @@ Several settings that apply to all controls of a same dashboard are available.
** **Apply global filters to controls** &mdash; Define whether controls should ignore or apply any filter specified in the main filter bar of the dashboard.
** **Apply global time range to controls** &mdash; Define whether controls should ignore or apply the main time range specified for the dashboard. Note that <<add-time-slider-controls,time slider controls>> rely on the global time range and don't work properly when this option is disabled.

* *Selection* settings:
* *Selections* settings:

** *Validate user selections* &mdash; When selected, any selected option that results in no data is ignored.
** *Chain controls* &mdash; When selected, controls are applied sequentially from left to right, and line by line. Any selected options in one control narrows the available options in the next control.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion oas_docs/examples/create_es_query_esql_rule_request.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
summary: Create an Elasticsearch query rule that uses Elasticsearch Query Language (ES|QL).
summary: Elasticsearch query rule (ES|QL)
description: >
Create an Elasticsearch query rule that uses Elasticsearch Query Language (ES|QL) to define its query and a server log connector to send notifications.
value:
name: my Elasticsearch query ESQL rule
params:
Expand Down
3 changes: 2 additions & 1 deletion oas_docs/examples/create_es_query_esql_rule_response.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
summary: The create rule API returns a JSON object that contains details about the rule.
summary: Elasticsearch query rule (ES|QL)
description: The response for successfully creating an Elasticsearch query rule that uses Elasticsearch Query Language (ES|QL).
value:
id: e0d62360-78e8-11ee-9177-f7d404c8c945
enabled: true
Expand Down
3 changes: 2 additions & 1 deletion oas_docs/examples/create_es_query_kql_rule_request.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
summary: Create an Elasticsearch query rule that uses Kibana query language (KQL).
summary: Elasticsearch query rule (KQL)
description: Create an Elasticsearch query rule that uses Kibana query language (KQL).
value:
consumer: alerts
name: my Elasticsearch query KQL rule
Expand Down
3 changes: 2 additions & 1 deletion oas_docs/examples/create_es_query_kql_rule_response.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
summary: The create rule API returns a JSON object that contains details about the rule.
summary: Elasticsearch query rule (KQL)
description: The response for successfully creating an Elasticsearch query rule that uses Kibana query language (KQL).
value:
id: 7bd506d0-2284-11ee-8fad-6101956ced88
enabled: true
Expand Down
4 changes: 3 additions & 1 deletion oas_docs/examples/create_es_query_rule_request.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
summary: Create an Elasticsearch query rule that uses Elasticsearch query domain specific language (DSL) to define its query and a server log connector to send notifications.
summary: Elasticsearch query rule (DSL)
description: >
Create an Elasticsearch query rule that uses Elasticsearch query domain specific language (DSL) to define its query and a server log connector to send notifications.
value:
actions:
- group: query matched
Expand Down
3 changes: 2 additions & 1 deletion oas_docs/examples/create_es_query_rule_response.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
summary: The create rule API returns a JSON object that contains details about the rule.
summary: Elasticsearch query rule (DSL)
description: The response for successfully creating an Elasticsearch query rule that uses Elasticsearch query domain specific language (DSL).
value:
id: 58148c70-407f-11ee-850e-c71febc4ca7f
enabled: true
Expand Down
4 changes: 3 additions & 1 deletion oas_docs/examples/create_index_threshold_rule_request.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
summary: Create an index threshold rule.
summary: Index threshold rule
description: >
Create an index threshold rule that uses a server log connector to send notifications when the threshold is met.
value:
actions:
- id: 48de3460-f401-11ed-9f8e-399c75a2deeb
Expand Down
3 changes: 2 additions & 1 deletion oas_docs/examples/create_index_threshold_rule_response.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
summary: The create rule API returns a JSON object that contains details about the rule.
summary: Index threshold rule
description: The response for successfully creating an index threshold rule.
value:
actions:
- group: threshold met
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
summary: Create a tracking containment rule.
summary: Tracking containment rule
description: >
Create a tracking containment rule that checks when an entity is contained or no longer contained within a boundary.
value:
consumer: alerts
name: my tracking rule
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
summary: The create rule API returns a JSON object that contains details about the rule.
summary: Tracking containment rule
description: The response for successfully creating a tracking containment rule.
value:
id: b6883f9d-5f70-4758-a66e-369d7c26012f
name: my tracking rule
Expand Down
3 changes: 2 additions & 1 deletion oas_docs/examples/find_rules_response.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
summary: Retrieve information about a rule.
summary: Index threshold rule
description: A response that contains information about an index threshold rule.
value:
page: 1
total: 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
summary: Retrieve information about a rule that has conditional actions.
summary: Security rule
description: A response that contains information about a security rule that has conditional actions.
value:
page: 1
total: 1
Expand Down
3 changes: 2 additions & 1 deletion oas_docs/examples/update_rule_request.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
summary: Update an index threshold rule.
summary: Index threshold rule
description: Update an index threshold rule that uses a server log connector to send notifications when the threshold is met.
value:
actions:
- frequency:
Expand Down
3 changes: 2 additions & 1 deletion oas_docs/examples/update_rule_response.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
summary: The update rule API returns a JSON object that contains details about the rule.
summary: Index threshold rule
description: The response for successfully updating an index threshold rule.
value:
id: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74
consumer: alerts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ interface Props {
isSideNavCollapsed$: Observable<boolean>;
}

const PANEL_WIDTH = 290;

export const ProjectNavigation: FC<PropsWithChildren<Props>> = ({
children,
isSideNavCollapsed$,
Expand All @@ -29,11 +31,10 @@ export const ProjectNavigation: FC<PropsWithChildren<Props>> = ({
data-test-subj="projectLayoutSideNav"
isCollapsed={isCollapsed}
onCollapseToggle={toggleSideNav}
css={
isCollapsed
? undefined
: { overflow: 'visible', clipPath: 'polygon(0 0, 300% 0, 300% 100%, 0 100%)' }
}
css={{
overflow: 'visible',
clipPath: `polygon(0 0, calc(var(--euiCollapsibleNavOffset) + ${PANEL_WIDTH}px) 0, calc(var(--euiCollapsibleNavOffset) + ${PANEL_WIDTH}px) 100%, 0 100%)`,
}}
>
{children}
</EuiCollapsibleNavBeta>
Expand Down
18 changes: 18 additions & 0 deletions packages/kbn-esql-editor/src/history_local_storage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,24 @@ describe('history local storage', function () {
);
});

it('should update queries to cache correctly if they are the same with different format', function () {
addQueriesToCache({
queryString: 'from kibana_sample_data_flights | limit 10 | stats meow = avg(woof) ',
timeZone: 'Browser',
status: 'success',
});

const historyItems = getCachedQueries();
expect(historyItems.length).toBe(2);
expect(historyItems[1].timeRan).toBeDefined();
expect(historyItems[1].status).toBe('success');

expect(mockSetItem).toHaveBeenCalledWith(
'QUERY_HISTORY_ITEM_KEY',
JSON.stringify(historyItems)
);
});

it('should allow maximum x queries ', function () {
addQueriesToCache(
{
Expand Down
15 changes: 5 additions & 10 deletions packages/kbn-esql-editor/src/history_local_storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface QueryHistoryItem {
const MAX_QUERIES_NUMBER = 20;

const getKey = (queryString: string) => {
return queryString.replaceAll('\n', '').trim();
return queryString.replaceAll('\n', '').trim().replace(/\s\s+/g, ' ');
};

const getMomentTimeZone = (timeZone?: string) => {
Expand Down Expand Up @@ -60,6 +60,9 @@ export const addQueriesToCache = (
item: QueryHistoryItem,
maxQueriesAllowed = MAX_QUERIES_NUMBER
) => {
// if the user is working on multiple tabs
// the cachedQueries Map might not contain all
// the localStorage queries
const queries = getHistoryItems('desc');
queries.forEach((queryItem) => {
const trimmedQueryString = getKey(queryItem.queryString);
Expand All @@ -77,15 +80,7 @@ export const addQueriesToCache = (
});
}

const queriesToStore = getCachedQueries();
const localStorageQueries = getHistoryItems('desc');
// if the user is working on multiple tabs
// the cachedQueries Map might not contain all
// the localStorage queries
const newQueries = localStorageQueries.filter(
(ls) => !queriesToStore.find((cachedQuery) => cachedQuery.queryString === ls.queryString)
);
let allQueries = [...queriesToStore, ...newQueries];
let allQueries = [...getCachedQueries()];

if (allQueries.length >= maxQueriesAllowed + 1) {
const sortedByDate = allQueries.sort((a, b) =>
Expand Down
Loading

0 comments on commit 85d10b7

Please sign in to comment.