-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Handle metadata fields in search 'fields' option #63569
Comments
Pinging @elastic/es-search (:Search/Search) |
We discussed this as a group, and agreed we'd only like to return metadata fields if they're explicitly requested. They will not be returned when requesting |
Currently metadata fields like `_size` or `_doc_count` cannot be retrieved using the fields API. With this change, we allow this if the field is explicitely queried for using its name, but won't include metadata fields when e.g. requesting all fields via "*". With this change, not all metadata fields will be retrievable by using its name, but support for "_size" and "_doc_count" (which is fetched from source) is added. Support for other metadata field types will need to be decided case by case and an appropriate ValueFetcher needs to be supplied. Relates to elastic#63569
I took a first look at how this might work and opened a PR with #70575. I don't know if it was already discussed, but my guess is that we want to decide which other metadata fields to support on a case-by-case basis. For example, I don't know if we want to support "_seq_no", in any case most of these field types currently don't return their own valueFetcher but throw an exception instead. We would need to change that for the fields we want to support. |
We didn't discuss what metadata fields to return explicitly. I'm curious to hear what others think, but from my perspective, your PR is the right first step -- it covers the helpful case of In the future, maybe we could consider unifying the retrieval for most metadata fields through the |
Currently metadata fields like `_size` or `_doc_count` cannot be retrieved using the fields API. With this change, we allow this if the field is explicitely queried for using its name, but won't include metadata fields when e.g. requesting all fields via "*". With this change, not all metadata fields will be retrievable by using its name, but support for "_size" and "_doc_count" (which is fetched from source) is added. Support for other metadata field types will need to be decided case by case and an appropriate ValueFetcher needs to be supplied. Relates to #63569
Currently metadata fields like `_size` or `_doc_count` cannot be retrieved using the fields API. With this change, we allow this if the field is explicitely queried for using its name, but won't include metadata fields when e.g. requesting all fields via "*". With this change, not all metadata fields will be retrievable by using its name, but support for "_size" and "_doc_count" (which is fetched from source) is added. Support for other metadata field types will need to be decided case by case and an appropriate ValueFetcher needs to be supplied. Relates to #63569
I'm closing this out since we covered the issue focus:
|
Currently the search 'fields' option skips over metadata fields. It would be great to add support for them, to help make 'fields' the central place to retrieve document content.
Some specific improvements:
_size
fromdocvalue_fields
(Document using docvalue_fields to retrieve_size
field from mapper size plugin #57103)._doc_count
(Add doc_count field mapper #58339). The 'fields' option should retrieve these like any other field value.An open question: should only return metadata fields if they're explicitly requested, or allow wildcard patterns like
*
to match them?The text was updated successfully, but these errors were encountered: