Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Updates runtime example in Discover #100926

Merged
merged 3 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docs/discover/images/add-field-to-pattern.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 added docs/discover/images/customer.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/discover/images/discover-from-visualize.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/discover/images/discover-visualize.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/discover/images/document-table-expanded.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/discover/images/document-table.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/discover/images/hello-field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 26 additions & 14 deletions docs/user/discover.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,20 @@ image:images/find-manufacturer-field.png[Fields list that displays the top five

. Click image:images/add-icon.png[Add icon] to toggle the field into the document table.

. Find the `day of week` field and add it to your document table. Your table should look like this:
. Find the `customer_first_name` and `customer_last_name` last name fields and add
them to your document table. Your table should look similar to this:
+
[role="screenshot"]
image:images/document-table.png[Document table with fields for manufacturer, geo.country_iso_code, and day_of_week]

image:images/document-table.png[Document table with fields for manufacturer, customer_first_name, and customer_last_name]

. To rearrange the table columns, hover the mouse over a
column header, and then use the move and sort controls.
column header, and then use the move controls.

. To view more of the document table, click *Hide chart*.

[float]
[[add-field-in-discover]]
=== Add a field
=== Add a field to your index pattern

What happens if you forgot to define an important value as a separate field? Or, what if you
want to combine two fields and treat them as one?
Expand All @@ -129,23 +131,33 @@ image:images/add-field-to-pattern.png[Dropdown menu located next to index patter

. Turn on *Set value*.

. Use the Painless scripting language to define the field:
. Define the script using the Painless scripting language. Runtime fields require an `emit()`.
+
```ts
emit("Hello World!");
```

. Click *Save*.

. In the fields list, search for the *hello* field, and then click it.
+
You'll see the top values for the field. The pop-up also includes actions for filtering,
editing, and deleting the field.
. In the fields list, search for the *hello* field, and then add it to the table to view it's value.
+
[role="screenshot"]
image:images/hello-field.png[Top values for the hello field, width=50%]
image:images/hello-field.png[hello field in the document table]

For more information on adding fields and Painless scripting language examples, refer to <<runtime-fields, Explore your data with runtime fields>>.
. Create a second field named `customer` that combines customer last name and first initial.
+
```ts
String str = doc['customer_first_name.keyword'].value;
char ch1 = str.charAt(0);
emit(doc['customer_last_name.keyword'].value + ", " + ch1);
```
. Simplify the the document table by removing `customer_first_name` and `customer_last_name` and adding `customer` in their place.
+
[role="screenshot"]
image:images/customer.png[Customer last name, first initial in the document table]
+
For more information on adding fields and Painless scripting language examples,
refer to <<runtime-fields, Explore your data with runtime fields>>.


[float]
Expand Down Expand Up @@ -202,7 +214,7 @@ click the close icon (x) next to its name in the filter bar.
Dive into an individual document to view its fields and the documents
that occurred before and after it.

. In the document table, expand any document. To view more of the document table, click *Hide chart*.
. In the document table, expand any document.
+
[role="screenshot"]
image:images/document-table-expanded.png[Table view with document expanded]
Expand Down Expand Up @@ -238,7 +250,7 @@ image:images/discover-save-saved-search.png[Save saved search in Discover, width
If a field can be {ref}/search-aggregations.html[aggregated], you can quickly
visualize it from **Discover**.

. From the **Selected fields** list, click `day_of_week`, and then click **Visualize**.
. From the **Available fields** list, click `day_of_week`, and then click **Visualize**.
+
[role="screenshot"]
image:images/discover-visualize.png[Discover sidebar field popover with visualize button, width=75%]
Expand Down