2016-10-25 03:41:32 +02:00
|
|
|
[[field-filter]]
|
2019-12-17 20:48:55 +01:00
|
|
|
== Filtering by field
|
2016-10-25 03:41:32 +02:00
|
|
|
|
2019-12-17 20:48:55 +01:00
|
|
|
*Discover* offers
|
|
|
|
various types of filters, so you can restrict your documents to the exact data you want.
|
|
|
|
For example, you might look at the results for a
|
|
|
|
particular period of time. Or, you might include—or exclude—
|
|
|
|
all HTTP redirects that come from a specific IP and port.
|
2016-10-25 03:41:32 +02:00
|
|
|
|
2019-12-17 20:48:55 +01:00
|
|
|
[float]
|
|
|
|
=== Add a filter
|
|
|
|
|
|
|
|
A quick way to add a filter is from the fields list.
|
2016-10-25 03:41:32 +02:00
|
|
|
|
2019-12-17 20:48:55 +01:00
|
|
|
. Click the field to filter on.
|
|
|
|
+
|
|
|
|
You'll see the number of documents that contain
|
|
|
|
the field, the top 5 values for the field, and the percentage of documents
|
|
|
|
that contain each value.
|
2016-10-31 15:13:41 +01:00
|
|
|
+
|
2019-11-21 20:57:21 +01:00
|
|
|
[role="screenshot"]
|
|
|
|
image::images/filter-field.png[height=317]
|
2019-12-17 20:48:55 +01:00
|
|
|
|
|
|
|
. Use the image:images/PositiveFilter.jpg[Positive Filter] icon to
|
|
|
|
show only documents that contain that value,
|
|
|
|
or image:images/NegativeFilter.jpg[Negative Filter] to exclude all documents with that value.
|
2016-10-31 15:13:41 +01:00
|
|
|
+
|
2019-12-17 20:48:55 +01:00
|
|
|
If there is no data to display, you might need to set a <<set-time-filter, date time filter>>.
|
|
|
|
You can choose a time from the quick filter or choose your
|
|
|
|
own using absolute or relative times.
|
|
|
|
|
|
|
|
. Try also these filtering options:
|
|
|
|
+
|
|
|
|
* To limit the field
|
|
|
|
list to a particular data type, click *Filter by type*.
|
|
|
|
You can also filter for whether that type is
|
|
|
|
aggregatable or searchable.
|
2017-06-22 03:33:21 +02:00
|
|
|
+
|
2019-12-17 20:48:55 +01:00
|
|
|
* To filter for whether a field is present, expand the document in
|
|
|
|
the document table, hover over the field, and click the *Filter for field present* icon.
|
|
|
|
|
|
|
|
[float]
|
|
|
|
=== Filter by condition
|
|
|
|
|
|
|
|
You can filter using advanced criteria,
|
|
|
|
such as if a value is equal to or in between certain values.
|
|
|
|
|
|
|
|
. Click *Add Filter*.
|
|
|
|
|
|
|
|
. Select a field.
|
|
|
|
|
|
|
|
. Select an operation for your filter:
|
2017-06-22 03:33:21 +02:00
|
|
|
+
|
|
|
|
[horizontal]
|
2019-12-17 20:48:55 +01:00
|
|
|
`is`:: The value for the field matches the given value.
|
|
|
|
`is not`:: The value for the field does not match the given value.
|
|
|
|
`is one of`:: The field matches one of the specified values.
|
|
|
|
`is not one of`:: The value for the field does not match any of the specified values.
|
|
|
|
`is between`:: The value for the field is in the given range.
|
|
|
|
`is not between`:: The value for the field is not in the given range.
|
|
|
|
`exists`:: Any value is present for the field.
|
|
|
|
`does not exist`:: No value is present for the field.
|
|
|
|
. Choose values for your filter.
|
2017-06-22 03:33:21 +02:00
|
|
|
+
|
2019-12-17 20:48:55 +01:00
|
|
|
Values from your indices may be suggested
|
|
|
|
as selections if you are filtering against an aggregatable field.
|
2017-06-22 03:33:21 +02:00
|
|
|
|
2019-12-17 20:48:55 +01:00
|
|
|
. (Optional) Specify a label for the filter.
|
|
|
|
|
|
|
|
. Click *Save* to apply the filter to your search.
|
|
|
|
+
|
2017-08-26 01:38:49 +02:00
|
|
|
NOTE: If you are experiencing long-running queries as a result of the value suggestions, you can
|
2019-12-17 20:48:55 +01:00
|
|
|
turn off the suggestions by setting `filterEditor:suggestValues` to `false`
|
|
|
|
in <<advanced-options,
|
|
|
|
Advanced Settings>>.
|
2017-07-27 01:33:16 +02:00
|
|
|
|
2016-10-25 03:41:32 +02:00
|
|
|
[float]
|
2016-10-31 15:13:41 +01:00
|
|
|
[[filter-pinning]]
|
2019-12-17 20:48:55 +01:00
|
|
|
=== Edit, disable, and delete filters
|
|
|
|
|
|
|
|
To modify a filter, click its tag, and then select one of the following actions.
|
|
|
|
|
|
|
|
*Pin across all apps*::
|
|
|
|
Persist the filter
|
|
|
|
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*.
|
|
|
|
A filter is based on a particular index field—if the indices being
|
|
|
|
searched do not contain the field in a pinned filter, it has no effect.
|
2016-10-31 15:13:41 +01:00
|
|
|
|
2019-12-17 20:48:55 +01:00
|
|
|
*Edit filter*::
|
|
|
|
Edit the
|
|
|
|
filter definition and label.
|
2016-10-31 15:13:41 +01:00
|
|
|
|
2019-12-17 20:48:55 +01:00
|
|
|
*Exclude results*::
|
|
|
|
Switch from a positive
|
|
|
|
filter to a negative filter, and vice versa.
|
2016-10-31 15:13:41 +01:00
|
|
|
|
2019-12-17 20:48:55 +01:00
|
|
|
*Temporarily disable*::
|
|
|
|
Disable the filter without
|
|
|
|
removing it. Click again to reenable the filter.
|
|
|
|
|
|
|
|
*Delete*::
|
|
|
|
Delete the filter.
|
|
|
|
|
|
|
|
To apply an action to all filters,
|
|
|
|
click the *Actions* icon, and then select the action.
|
2016-10-31 15:13:41 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[float]
|
|
|
|
[[filter-edit]]
|
2019-12-17 20:48:55 +01:00
|
|
|
=== Modify the filter query
|
2016-10-31 15:13:41 +01:00
|
|
|
|
2019-12-17 20:48:55 +01:00
|
|
|
You can directly modify
|
|
|
|
the query that filters your search results. This enables you
|
|
|
|
to create more complex filters using multiple fields.
|
2016-10-31 15:13:41 +01:00
|
|
|
|
2019-12-17 20:48:55 +01:00
|
|
|
. Click the filter tag, and then select *Edit > Edit Query DSL*.
|
|
|
|
|
|
|
|
. Edit the query for the filter.
|
|
|
|
+
|
|
|
|
////
|
|
|
|
image::images/edit_filter_query_json.png[]
|
|
|
|
+
|
|
|
|
////
|
|
|
|
For example, if you are using the sample log data, you can use the
|
|
|
|
{ref}/query-dsl-bool-query.html[bool query] to create a filter
|
|
|
|
that displays the hits that originated from Canada or China that resulted in a 404 error:
|
|
|
|
+
|
2016-10-31 15:13:41 +01:00
|
|
|
==========
|
|
|
|
[source,json]
|
|
|
|
{
|
|
|
|
"bool": {
|
|
|
|
"should": [
|
|
|
|
{
|
|
|
|
"term": {
|
|
|
|
"geoip.country_name.raw": "Canada"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"term": {
|
|
|
|
"geoip.country_name.raw": "China"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"must": [
|
|
|
|
{
|
|
|
|
"term": {
|
|
|
|
"response": "404"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
2017-06-22 03:33:21 +02:00
|
|
|
==========
|