-
Notifications
You must be signed in to change notification settings - Fork 25.4k
Handle unmapped fields in _field_caps API #34071
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
Conversation
Pinging @elastic/es-search-aggs |
\cc @costin |
@costin What is the use-case for this? |
The reason behind it comes from index patterns - as a consumer it's unclear what indices match the query and thus what the returned fields refer to. in SQL this will be used to implement
|
We discussed this internally with @jpountz and @costin . Returning the list of indices per field is too verbose and defeats the purpose of this API which is to get a merged mapping of all fields that are present in an index pattern. Though there are some useful informations that are missing in the API currently:
For the first bullet we discussed the possibility to add a top-level entry in the response that lists all concrete indices that match the pattern:
For the second one we could add a new type
In the example above, |
Thanks for the ping @jimczi. Someone on @elastic/kibana-management is probably best equipped to answer this question at the moment, as far as I know we only use field_caps when creating a new index pattern in management. |
From Kibana Management perspective when creating index patterns, we will need to add There are a few other areas in Kibana that use
Going back to the original problem, I suppose this information could be inferred the hard way by finding the difference between the top-level |
Unfortunately that is not the case. If a field has the same mapping across all the indices where it is mapped, it return This could be alleviated by specifying the indices for field type but that's much more verbose then declaring the indices once per request (at the top-level) and being explicit about unmapped. This is also consistent with #33803 - simply assuming a type is a primitive is bound to create issues when dealing with complex types ( |
I changed the pr to reflect the latest discussions, |
test this please |
Today the `_field_caps` API returns the list of indices where a field is present only if this field has different types within the requested indices. However if the request is an index pattern (or an alias, or both...) there is no way to infer the indices if the response contains only fields that have the same type in all indices. This commit changes the response to always return the list of indices in the response. It also adds a way to retrieve unmapped field in a specific section per field called `unmapped`. This section is created for each field that is present in some indices but not all if the parameter `include_unmapped` is set to true in the request (defaults to false).
9206f48
to
b740e99
Compare
Fwiw, LGTM |
Thanks to elastic#34071, there is enough information in field caps to infer the table structure and thus use the same API consistently across the IndexResolver.
Thanks to #34071, there is enough information in field caps to infer the table structure and thus use the same API consistently across the IndexResolver.
Today the `_field_caps` API returns the list of indices where a field is present only if this field has different types within the requested indices. However if the request is an index pattern (or an alias, or both...) there is no way to infer the indices if the response contains only fields that have the same type in all indices. This commit changes the response to always return the list of indices in the response. It also adds a way to retrieve unmapped field in a specific section per field called `unmapped`. This section is created for each field that is present in some indices but not all if the parameter `include_unmapped` is set to true in the request (defaults to false).
After #34071 the FieldCapabilitiesResponse response map is unmodifiable
Today the `_field_caps` API returns the list of indices where a field is present only if this field has different types within the requested indices. However if the request is an index pattern (or an alias, or both...) there is no way to infer the indices if the response contains only fields that have the same type in all indices. This commit changes the response to always return the list of indices in the response. It also adds a way to retrieve unmapped field in a specific section per field called `unmapped`. This section is created for each field that is present in some indices but not all if the parameter `include_unmapped` is set to true in the request (defaults to false).
Today the `_field_caps` API returns the list of indices where a field is present only if this field has different types within the requested indices. However if the request is an index pattern (or an alias, or both...) there is no way to infer the indices if the response contains only fields that have the same type in all indices. This commit changes the response to always return the list of indices in the response. It also adds a way to retrieve unmapped field in a specific section per field called `unmapped`. This section is created for each field that is present in some indices but not all if the parameter `include_unmapped` is set to true in the request (defaults to false).
Thanks to elastic#34071, there is enough information in field caps to infer the table structure and thus use the same API consistently across the IndexResolver.
Today the
_field_caps
API returns the list of indices where a fieldis present only if this field has different types within the requested indices.
However if the request is an index pattern (or an alias, or both...) there
is no way to infer the indices if the response contains only fields that have
the same type in all indices. This commit changes the response to always return
the list of indices for a specific fields. It makes the response more verbose
but it will allow users of this API to retrieve easily the indices where a field
is present.