|
1 | 1 | [[discover-search-for-relevance]] |
2 | 2 | == Search for relevance |
3 | | -Sometimes you might be unsure which documents best match your question. |
| 3 | +Sometimes you might be unsure which documents best match your search. |
4 | 4 | {es} assigns a relevancy, or score to each document, so you can |
5 | 5 | can narrow your search to the documents with the most relevant results. |
6 | 6 | The higher the score, the better it matches your query. |
7 | 7 |
|
8 | | -For example, suppose you have the <<gs-get-data-into-kibana, sample flights data set>>, and you're a searching for |
9 | | -a flight that arrived or departed from `Warsaw` or `Venice` when the weather was clear. |
| 8 | +This example shows how to use *Discover* to list |
| 9 | +your documents from most relevant to least relevant. This example uses |
| 10 | +the <<gs-get-data-into-kibana, sample flights data set>>, or you can use your own data. |
10 | 11 |
|
11 | | -. In *Discover*, open the index pattern dropdown, and select `kibana_sample_data_flight`. |
12 | | -. In the query bar, click *KQL*, and switch to the <<lucene-query, Lucene query syntax>>. |
13 | | -. Search for `Warsaw OR Venice OR Clear`. |
14 | | -. If you don't see any results, open the time filter and select a time range that contains data. |
15 | | -. From the list of *Available fields*, add `_score` to the document table. |
16 | | -. In the document table, click the header for the `_score` column, and then sort the column by descending scores. |
| 12 | +. In *Discover*, open the index pattern dropdown, and select that data you want to work with. |
17 | 13 | + |
18 | | -The results are currently sorted by first `Time`, and then by `_score`. |
19 | | -. To sort only by `_score`, remove the `Time` field. |
| 14 | +For the sample flights data, set the index pattern to *kibana_sample_data_flights*. |
| 15 | +. In the query bar, click *KQL*, and then turn it off. |
20 | 16 | + |
21 | | -Your table now shows documents with the best matches, from most to least relevant. |
| 17 | +You're now using the <<lucene-query, Lucene query syntax>>. |
| 18 | +. Run your search. For the sample data, try: |
| 19 | ++ |
| 20 | +```ts |
| 21 | +Warsaw OR Venice OR Clear |
| 22 | +``` |
| 23 | +. If you don't see any results, expand the <<set-time-filter,time range>>, for example to *Last 7 days*. |
| 24 | +. From the list of *Available fields*, add `_score` and any other fields you want to the document table. |
| 25 | +. To sort the `_score` column in descending order, hover over its header, and then click twice on |
| 26 | +the arrow icon |
| 27 | +image:images/double-arrow.png[Double arrow icon to indicate sorting] so it changes to |
| 28 | +image:images/downward-arrow.png[Downward pointing arrow to indicate descending sorting]. |
| 29 | ++ |
| 30 | +At this point, you're doing a multi-column sort: first by `Time`, and then by `_score`. |
| 31 | +. To turn off sorting for the `Time` field, hover over its header, and then click the down arrow. |
| 32 | ++ |
| 33 | +Your table now sorts documents from most to least relevant. |
22 | 34 | + |
23 | 35 | [role="screenshot"] |
24 | 36 | image::images/discover-search-for-relevance.png["Example of a search for relevance"] |
0 commit comments