Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to retrieve document metadata via fields option #78939

Merged
merged 8 commits into from
Oct 14, 2021

Conversation

cbuescher
Copy link
Member

@cbuescher cbuescher commented Oct 11, 2021

Currently we exclude metadata fields from being looked up using the fields option in search.
However, as issue like #75836 show, they can still be retrieved e.g. via aliases and then fetching
their values causes errors.
With this change, we enable retrieval of metadata fields (like _id, _ignored etc.) using the fields
option when the field is explicitely requested. We still continue to exclude any metadata field from
matching wildcard patterns, but they should be retrievable via an exact name or if there is an alias
definition with a path to a metadata field.
This change adds support for the _id, _routing, _ignored, _index and _version field in particular.

Backport of #78828, #78981 and #79042

Currently we exclude metadata fields from being looked up using the `fields` option in search.
However, as issue like elastic#75836 show, they can still be retrieved e.g. via aliases and then fetching
their values causes errors.
With this change, we enable retrieval of metadata fields (like `_id`) using the fields option when
 the field is explicitely asked for. We still continue to exclude any metadata field from matching
wildcard patterns, but they should be retrievable via an exact name or if there is an alias definition
with a path to a metadata field. This change adds support for the `_id` field in particular.
Christoph Büscher added 5 commits October 13, 2021 17:24
…78981)

Currently we don't allow retrieving metadata fields through the fields option in
search but throw an error on this case. In elastic#78828 we started to enable this for
`_id` if the field is explicitely requested. This PR adds `_ignored` and
`_routing` metadata fields which are also internally handled as stored fields to
the list of fields that can be explicitely retrieved.
@cbuescher cbuescher changed the title Add ability to retrieve _id via fields option Add ability to retrieve document metadata via fields option Oct 14, 2021
Christoph Büscher added 2 commits October 14, 2021 14:18
)

Currently we don't allow retrieving metadata fields through the fields option in search but throw
an error on this case. In elastic#78828 we started to enable this for "_id" if the field is explicitely requested.
This PR adds _index and _version metadata fields which are internally stored as doc values to
the list of fields that can be explicitely retrieved.

Relates to elastic#75836
@cbuescher cbuescher merged commit e7c6ed8 into elastic:7.x Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant