You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: solutions/search/esql-full-text-filter-tutorial.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -223,7 +223,7 @@ POST /_query?format=txt
223
223
OR match(description, "vegetarian curry")
224
224
OR match(tags, "vegetarian curry")
225
225
| KEEP title, description, tags, _score # Include relevance score in results
226
-
| SORT _score DESC # Including `METADATA _score` doesn't automatically sort your results by relevance, you must explicitly sort when the order of results matters
226
+
| SORT _score DESC # You must explicitly sort by `_score` to see relevance-based results
227
227
| LIMIT 1000
228
228
"""
229
229
}
@@ -232,11 +232,11 @@ POST /_query?format=txt
232
232
In this example, we're using the `boost` parameter to make matches in the title field twice as important as matches in other fields. We also request the `_score` metadata field to sort results by relevance.
233
233
234
234
:::{tip}
235
-
When working with relevance scoring in {{esql}}, it's important to understand how `_score` works. If you don't include `METADATA _score` in your query, you're only performing filtering operations with no relevance calculation.
235
+
When working with relevance scoring in ES|QL, it's important to understand how `_score` works. If you don't include `METADATA _score` in your query, you're only performing filtering operations with no relevance calculation.
236
236
237
-
In current versions, when you include `METADATA _score`, both full-text search functions (like `match()` or the `:` operator) and filtering operations (like range conditions and exact matches) contribute to the relevance score. Full-text search functions provide variable scores based on relevance, while filtering operations add a constant score component.
237
+
When you include `METADATA _score`, only search functions contribute to the relevance score. Filtering operations (like range conditions and exact matches) don't affect the score.
238
238
239
-
This behavior will change in future versions, where only full-text search functions will affect scoring, and filtering operations won't contribute to the score at all.
239
+
Remember that including `METADATA _score` doesn't automatically sort your results by relevance. You must explicitly use `SORT _score DESC` or `SORT _score ASC`to order your results by relevance.
0 commit comments