You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR:
- Adds a section about creating variable controls in Discover, with
sub-sections on how to edit them and how to bring these controls over to
a dashboard
- Transforms certain pieces of content into content snippets that are
shared between Discover and Dashboards docs as variable controls are
used in both apps: code examples, control parameters.
- Adds the section about "how to bring Discover sessions along with
their controls to a dashboard" to the "Add controls" page in dashboards
docs as well. This content is single-sourced so only maintained in one
place.
- Re-adds a "preview" flag to the Variable controls section in dashboard
docs, that one was mistakenly removed in another PR
Find page previews in one of the comments below
Note: Tested on staging environment on Oct 10
Closes: elastic#3096
---------
Co-authored-by: Stratou <[email protected]>
Co-authored-by: Benjamin Ironside Goldstein <[email protected]>
To add a Discover query to a dashboard in a way that preserves the [controls created from Discover](/explore-analyze/discover/try-esql.md#add-variable-control-discover) and also adds them to the dashboard, do as follows:
2
+
3
+
1. Save the {{esql}} query containing the variable control into a Discover session. If your Discover session contains several tabs, only the first tab will be imported to the dashboard.
4
+
5
+
1. Go to **Dashboards** and open or create one.
6
+
7
+
1. Select **Add**, then **From library**.
8
+
9
+
1. Find and select the Discover session you saved earlier.
10
+
11
+
A new panel appears on the dashboard with the results of the query along with any attached controls.
12
+
13
+

14
+
15
+
:::{note}
16
+
When you add a visualization to a dashboard using the {icon}`save`**Save visualization** option, controls are not added to the dashboard.
* For controls with **Static values**, enter available controls manually or select them from the dropdown list.
3
+
* For controls with **Values from a query**, write an {{esql}} query to populate the list of options.
4
+
* The name of the control. This name is used to reference the control in {{esql}} queries.
5
+
* Start the name with `?` if you want the options to be simple static values.
6
+
* {applies_to}`stack: ga 9.1` Start the name with `??` if you want the options to be fields or functions.
7
+
* The values users can select for this control. You can add multiple values from suggested fields, or type in custom values. If you selected **Values from a query**, you must instead write an {{esql}} query at this step.
8
+
* The label of the control. This is the label displayed in **Discover** or in the dashboard.
9
+
* The width of the control.
10
+
11
+

Copy file name to clipboardExpand all lines: explore-analyze/dashboards/add-controls.md
+16-36Lines changed: 16 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,6 +90,10 @@ You can add one interactive time slider control to a dashboard.
90
90
91
91
92
92
## Add variable controls [add-variable-control]
93
+
```{applies_to}
94
+
stack: preview 9.0
95
+
serverless: preview
96
+
```
93
97
94
98
:::{note}
95
99
In versions `9.0` and `9.1`, variable controls are called {{esql}} controls.
@@ -113,17 +117,8 @@ Only **Options lists** are supported for {{esql}}-based controls. Options can be
113
117
114
118
2. A menu opens to let you configure the control. This is where you can specify:
115
119
116
-
* The type of the control.
117
-
* For controls with **Static values**, select the options available in the controls by entering them manually or by using a dropdown listing available values.
118
-
* For controls with **Values from a query**, write an {{esql}} query to populate the list of options.
119
-
* The name of the control. This name is used to reference the control in {{esql}} queries.
120
-
* Start the name with `?` if you want the options to be simple static values.
121
-
* Start the name with `??` if you want the options of the control to be fields or functions. {applies_to}`stack: ga 9.1`
122
-
* The values users can select for this control. You can add multiple values from suggested fields, or type in custom values. If you selected **Values from a query**, you must instead write an {{esql}} query at this step.
123
-
* The label of the control. This is the label displayed for users viewing the dashboard for that control.
124
-
* The width of the control.
125
-
126
-

* Integrate filtering into your {{esql}} experience
139
-
140
-
```esql
141
-
| WHERE field == ?value
142
-
```
143
-
144
-
* Fields in controls for dynamic group by
145
-
146
-
```esql
147
-
| STATS count=COUNT(*) BY ?field
148
-
```
149
-
150
-
* Variable time ranges? Bind function configuration settings to a control
151
-
152
-
```esql
153
-
| BUCKET(@timestamp, ?interval),
154
-
```
155
-
156
-
* Make the function itself dynamic
133
+

157
134
158
-
```esql
159
-
| STATS metric = ?function
160
-
```
135
+
### Import a Discover query along with its controls into a dashboard
136
+
```{applies_to}
137
+
stack: preview 9.2
138
+
serverless: preview
139
+
```
161
140
162
-

Copy file name to clipboardExpand all lines: explore-analyze/discover/try-esql.md
+40-1Lines changed: 40 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -188,4 +188,43 @@ To view or edit an index:
188
188
Editing a lookup index affects all {{esql}} queries that reference it. Make sure that your changes are compatible with existing queries that use this index.
189
189
:::
190
190
191
-
4. If you made changes, select **Save** before closing the flyout.
191
+
4. If you made changes, select **Save** before closing the flyout.
192
+
193
+
### Add variable controls to your Discover queries [add-variable-control-discover]
194
+
```{applies_to}
195
+
stack: preview 9.2
196
+
serverless: preview
197
+
```
198
+
199
+
Variable controls help you make your queries more dynamic instead of having to maintain several versions of almost identical queries.
200
+
201
+

202
+
203
+
You can add them from your Discover {{esql}} query.
204
+
205
+
1. While editing your {{esql}} query, the autocomplete menu suggests adding a control when relevant or when typing `?` in the query. Select **Create control**.
206
+
207
+
2. A menu opens to let you configure the control. This is where you can specify:
0 commit comments