Pārlūkot izejas kodu

Clarify pure wilcard matching with `query_string` (#26814)

In 5.x pure wildcard queries `*` in `query_string` are rewritten to `exists` query for efficiency.
Though this introduced a change in the document that match such queries because
`exists` query also return documents with an empty value for the field.
This change clarifies this behavior for 5.x and beyond.

Closes #26801

* review
Jim Ferenczi 8 gadi atpakaļ
vecāks
revīzija
17b9baf5fd
1 mainītis faili ar 19 papildinājumiem un 0 dzēšanām
  1. 19 0
      docs/reference/query-dsl/query-string-syntax.asciidoc

+ 19 - 0
docs/reference/query-dsl/query-string-syntax.asciidoc

@@ -53,6 +53,25 @@ Be aware that wildcard queries can use an enormous amount of memory and
 perform very badly -- just think how many terms need to be queried to
 match the query string `"a* b* c*"`.
 
+[WARNING]
+=======
+Pure wildcards `\*` are rewritten to <<query-dsl-exists-query,`exists`>> queries for efficiency.
+As a consequence, the wildcard `"field:*"` would match documents with an emtpy value
+ like the following:
+```
+{
+  "field": ""
+}
+```
+\... and would **not** match if the field is missing or set with an explicit null
+value like the following:
+```
+{
+  "field": null
+}
+```
+=======
+
 [WARNING]
 =======
 Allowing a wildcard at the beginning of a word (eg `"*ing"`) is particularly