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

Update docs with the addition of filter editors #12321

Merged
merged 2 commits into from
Jun 22, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
74 changes: 52 additions & 22 deletions docs/discover/field-filter.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ You can filter the search results to display only those documents that contain
a particular value in a field. You can also create negative filters that
exclude documents that contain the specified field value.

You add field filters from the Fields list or the Documents table. In addition
to creating positive and negative filters, the Documents table enables you to
filter on whether or not a field is present. The applied
filters are shown below the Query bar. Negative filters are shown in red.
You add field filters from the Fields list, the Documents table, or by manually
adding a filter. In addition to creating positive and negative filters, the
Documents table enables you to filter on whether or not a field is present. The
applied filters are shown below the Query bar. Negative filters are shown in red.

To add a filter from the Fields list:

. Click the name of the field you want to filter on. This displays the top
five values for that field.
five values for that field.
+
image::images/filter-field.jpg[]
. To add a positive filter, click the *Positive Filter* button
Expand All @@ -26,7 +26,7 @@ To add a filter from the Documents table:

. Expand a document in the Documents table by clicking the *Expand* button
image:images/ExpandButton.jpg[Expand Button] to the left of the document's
table entry.
table entry.
+
image::images/Expanded-Document.png[]
. To add a positive filter, click the *Positive Filter* button
Expand All @@ -40,6 +40,31 @@ field name. This excludes documents that contain that value in the field.
*Exists* button image:images/ExistsButton.jpg[Exists Button] to the right of the
field name. This includes only those documents that contain the field.

To manually add a filter:

. Click *Add Filter*. A popup will be displayed for you to create the filter.
+
image::images/add_filter.png[]
. Choose a field to filter by. This list of fields will include fields from the
index pattern you are currently querying against.
+
image::images/add_filter_field.png[]
. Choose an operation for your filter. You may filter where a field matches a
particular value by selecting *is*, where a filter doesn't match a particular
value by selecting *is not*, where a field is present (*exists*), or where a
value for a field is within a range (*is between*). In addition, you can filter
where a field *is one of* a particular list of values.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this list be better represented as a table? Explicitly describing exactly how each operator works. It might be overkill, but at least we're not missing anything. There are 6 different operators. I added something similar here for the options available in Timelion

+
image::images/add_filter_operator.png[]
. Choose the value(s) for your filter. Values from your indices may be suggested
as selections if you are filtering against an aggregatable field.
+
image::images/add_filter_value.png[]
. (Optional) Specify a label for the filter. If you specify a label, it will be
displayed below the query bar instead of the filter definition.
. Click *Save*. The filter will be applied to your search and be displayed below
the query bar.

[float]
[[filter-pinning]]
=== Managing Filters
Expand All @@ -55,33 +80,38 @@ removing it. Click again to reenable the filter. Diagonal stripes indicate
that a filter is disabled.
image:images/filter-pin.png[] Pin Filter :: Pin the filter. Pinned filters
persist when you switch contexts in Kibana. For example, you can pin a filter
in Discover and it remains in place when you switch to Visualize.
in Discover and it remains in place when you switch to Visualize.
Note that a filter is based on a particular index field--if the indices being
searched don't contain the field in a pinned filter, it has no effect.
searched don't contain the field in a pinned filter, it has no effect.
image:images/filter-toggle.png[] Toggle Filter :: Switch from a positive
filter to a negative filter and vice-versa.
filter to a negative filter and vice-versa.
image:images/filter-delete.png[] Remove Filter :: Remove the filter.
image:images/filter-custom.png[] Edit Filter :: <<filter-edit, Edit the
filter>> definition. Enables you to manually update the filter query and
image:images/filter-custom.png[] Edit Filter :: <<filter-edit, Edit the
filter>> definition. Enables you to manually update the filter and
specify a label for the filter.

To apply a filter action to all of the applied filters,
To apply a filter action to all of the applied filters,
click *Actions* and select the action.

[float]
[[filter-edit]]
=== Editing a Filter
You can edit a filter to directly modify the filter query that is performed
to filter your search results. This enables you to create more complex
filters that are based on multiple fields.
You can edit a filter by changing the field, operator, or value associated
with the filter (see the Add Filter section above), or by directly modifying
the filter query that is performed to filter your search results. This
enables you to create more complex filters that are based on multiple fields.

image::images/filter-custom-json.png[]

&nbsp;
. To edit the filter query, first click the edit button for the filter, then
click *Edit Query DSL*.
+
image::images/edit_filter_query.png[]
. You can then edit the query for the filter.
+
image::images/edit_filter_query_json.png[]

For example, you could use a {es-ref}/query-dsl-bool-query.html[bool query]
to create a filter for the sample log data that displays the hits that
originated from Canada or China that resulted in a 404 error:
For example, you could use a
{es-ref}/query-dsl-bool-query.html[bool query] to create a filter for the
sample log data that displays the hits that originated from Canada or China that resulted in a 404 error:

==========
[source,json]
Expand All @@ -108,4 +138,4 @@ originated from Canada or China that resulted in a 404 error:
]
}
}
==========
==========
Binary file added docs/images/add_filter.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/images/add_filter_field.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/images/add_filter_operator.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/images/add_filter_value.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/images/edit_filter_query.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/images/edit_filter_query_json.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 removed docs/images/filter-custom-json.png
Binary file not shown.