forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds various Query overrides to Keyword Field
The keywordfield mapper provides access to various query types, e.g. the termsQuery, fuzzyQuery. These are inherited as is from the StringType. But we do not take into account the fact that keyword fields can have doc_values enabled. This PR adds the ability for various queries to first check if doc_values are enabled and if so out-source the work to lucene to decide if it's better to use index values or doc_values when running queries. Signed-off-by: Harsha Vamsi Kalluri <[email protected]>
- Loading branch information
1 parent
3e64a7b
commit 9ec68e0
Showing
7 changed files
with
446 additions
and
18 deletions.
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
46 changes: 46 additions & 0 deletions
46
rest-api-spec/src/main/resources/rest-api-spec/test/search/340_keyword_doc_values.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,46 @@ | ||
--- | ||
"search on keyword fields with doc_values enabled": | ||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
mappings: | ||
properties: | ||
"some_keyword": | ||
type: "keyword" | ||
index: true | ||
doc_values: true | ||
|
||
- do: | ||
bulk: | ||
index: test | ||
refresh: true | ||
body: | ||
- '{"index": {"_index": "test", "_id": "1" }}' | ||
- '{ "some_keyword": "ingesting some random keyword data" }' | ||
- '{ "index": { "_index": "test", "_id": "2" }}' | ||
- '{ "some_keyword": "400" }' | ||
- '{ "index": { "_index": "test", "_id": "3" } }' | ||
- '{ "some_keyword": "5" }' | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
prefix: | ||
some_keyword: "ing" | ||
|
||
- match: { hits.hits.0._source.some_keyword: "ingesting some random keyword data" } | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
range: { | ||
"some_keyword": { | ||
"lt": 500 | ||
} } | ||
|
||
- match: { hits.total.value: 2 } |
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
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
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
Oops, something went wrong.