kibana/docs/discover/search-for-relevance.asciidoc
gchaps dfea0b3114
[DOCS] Updates search for relevance doc (#101439) (#101629)
* [DOCS] Updates search for relevance doc

* [DOCS] Better explanation of multi-column sorting

* [DOCS] Fixes typo
2021-06-08 09:04:57 -07:00

36 lines
1.7 KiB
Text

[[discover-search-for-relevance]]
== Search for relevance
Sometimes you might be unsure which documents best match your search.
{es} assigns a relevancy, or score to each document, so you can
can narrow your search to the documents with the most relevant results.
The higher the score, the better it matches your query.
This example shows how to use *Discover* to list
your documents from most relevant to least relevant. This example uses
the <<gs-get-data-into-kibana, sample flights data set>>, or you can use your own data.
. In *Discover*, open the index pattern dropdown, and select that data you want to work with.
+
For the sample flights data, set the index pattern to *kibana_sample_data_flights*.
. In the query bar, click *KQL*, and then turn it off.
+
You're now using the <<lucene-query, Lucene query syntax>>.
. Run your search. For the sample data, try:
+
```ts
Warsaw OR Venice OR Clear
```
. If you don't see any results, expand the <<set-time-filter,time range>>, for example to *Last 7 days*.
. From the list of *Available fields*, add `_score` and any other fields you want to the document table.
. To sort the `_score` column in descending order, hover over its header, and then click twice on
the arrow icon
image:images/double-arrow.png[Double arrow icon to indicate sorting] so it changes to
image:images/downward-arrow.png[Downward pointing arrow to indicate descending sorting].
+
At this point, you're doing a multi-column sort: first by `Time`, and then by `_score`.
. To turn off sorting for the `Time` field, hover over its header, and then click the down arrow.
+
Your table now sorts documents from most to least relevant.
+
[role="screenshot"]
image::images/discover-search-for-relevance.png["Example of a search for relevance"]