forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make empty string searches be consistent with case (in)sensitivity (e…
…lastic#110833) If we determine that the searchable term is completely empty, we switch back to a regular term query. This way we return the same docs as expected when we do a case sensitive search. closes: elastic#108968
- Loading branch information
Showing
3 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 110833 | ||
summary: Make empty string searches be consistent with case (in)sensitivity | ||
area: Search | ||
type: bug | ||
issues: [] |
37 changes: 37 additions & 0 deletions
37
rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/171_term_query.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
"case insensitive term query on blank keyword is consistent": | ||
- requires: | ||
cluster_features: [ "gte_v8.16.0" ] | ||
reason: "query consistency bug fix in 8.16.0" | ||
- do: | ||
indices.create: | ||
index: index_with_blank_keyword | ||
body: | ||
settings: | ||
number_of_shards: 1 | ||
mappings: | ||
properties: | ||
keyword_field: | ||
type: keyword | ||
- do: | ||
bulk: | ||
refresh: true | ||
body: | ||
- '{"index": {"_index": "index_with_blank_keyword", "_id": "1"}}' | ||
- '{"keyword_field": ""}' | ||
|
||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
index: index_with_blank_keyword | ||
body: {"query" : {"term" : {"keyword_field" : {"value": ""}}}} | ||
|
||
- match: { hits.total: 1 } | ||
|
||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
index: index_with_blank_keyword | ||
body: { "query": { "term": { "keyword_field": {"value": "", "case_insensitive": true } } } } | ||
|
||
- match: { hits.total: 1 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters