-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fetch meta fields in FetchFieldsPhase using ValueFetcher (#106325)
Here we extract the logic to populate metadata fields such as _ignored, _routing, _size and the deprecated _type into FetchFieldsPhase so that we can use the ValueFetcher interface to retrieve field values. This allows us to fetch values no matter if the Mapper uses stored or doc values.
- Loading branch information
1 parent
b9322da
commit 4dfcb08
Showing
7 changed files
with
453 additions
and
65 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
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
159 changes: 159 additions & 0 deletions
159
...-api-spec/src/yamlRestTest/resources/rest-api-spec/test/get/120_stored_fields_ignored.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,159 @@ | ||
--- | ||
"_ignored field through get api using stored_fields": | ||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
mappings: | ||
properties: | ||
keyword: | ||
type: keyword | ||
ignore_above: 5 | ||
ip: | ||
type: ip | ||
ignore_malformed: true | ||
value: | ||
type: long | ||
ignore_malformed: true | ||
|
||
- do: | ||
index: | ||
index: test | ||
id: 1 | ||
refresh: true | ||
body: | ||
keyword: foo | ||
ip: 192.168.0.1 | ||
value: 23 | ||
- do: | ||
index: | ||
index: test | ||
id: 2 | ||
refresh: true | ||
body: | ||
keyword: foobar | ||
ip: garbage | ||
value: missing | ||
- do: | ||
index: | ||
index: test | ||
id: 3 | ||
refresh: true | ||
body: | ||
keyword: | ||
- foo | ||
- bar | ||
- foobar | ||
ip: | ||
- 10.10.1.1 | ||
- 192.8.1.2 | ||
- 199.199.300.999 | ||
value: | ||
- 1 | ||
- 2 | ||
- ops | ||
|
||
- do: | ||
get: | ||
index: test | ||
id: 1 | ||
|
||
- match: {_index: "test"} | ||
- match: {_id: "1"} | ||
- match: {_version: 1} | ||
- match: {found: true} | ||
- match: | ||
_source: | ||
keyword: foo | ||
ip: 192.168.0.1 | ||
value: 23 | ||
|
||
- is_false: fields | ||
|
||
- do: | ||
get: | ||
index: test | ||
id: 2 | ||
- match: { _index: "test" } | ||
- match: { _id: "2" } | ||
- match: { _version: 1 } | ||
- match: { found: true } | ||
- match: | ||
_source: | ||
ip: garbage | ||
keyword: foobar | ||
value: missing | ||
|
||
- is_false: fields | ||
|
||
- do: | ||
get: | ||
index: test | ||
id: 3 | ||
- match: { _index: "test" } | ||
- match: { _id: "3" } | ||
- match: { _version: 1 } | ||
- match: { found: true } | ||
- match: | ||
_source: | ||
ip: | ||
- 10.10.1.1 | ||
- 192.8.1.2 | ||
- 199.199.300.999 | ||
keyword: | ||
- foo | ||
- bar | ||
- foobar | ||
value: | ||
- 1 | ||
- 2 | ||
- ops | ||
|
||
- is_false: fields | ||
|
||
- do: | ||
get: | ||
index: test | ||
id: 1 | ||
stored_fields: | ||
- _ignored | ||
|
||
- match: { _index: "test" } | ||
- match: { _id: "1" } | ||
- match: { _version: 1 } | ||
- match: { found: true } | ||
- match: { _ignored: null} | ||
|
||
- do: | ||
get: | ||
index: test | ||
id: 2 | ||
stored_fields: | ||
- _ignored | ||
|
||
- match: { _index: "test" } | ||
- match: { _id: "2" } | ||
- match: { _version: 1 } | ||
- match: { found: true } | ||
- match: | ||
_ignored: | ||
- ip | ||
- keyword | ||
- value | ||
|
||
- do: | ||
get: | ||
index: test | ||
id: 3 | ||
stored_fields: | ||
- _ignored | ||
|
||
- match: { _index: "test" } | ||
- match: { _id: "3" } | ||
- match: { _version: 1 } | ||
- match: { found: true } | ||
- match: | ||
_ignored: | ||
- ip | ||
- keyword | ||
- value |
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.