-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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 source_path information to field_caps API #49264
Comments
Pinging @elastic/es-search (:Search/Mapping) |
One complexity to note is that a field could have a different |
Would it be good enough to return an array that contains both the old and new name in that case? I believe we would need the |
We discussed offline and came up with the proposal that Here's a sketch for how it could look to include index information for
|
This makes sense to me. I wonder how to handle meta fields (e.g. For meta fields, maybe we don't need to do anything and just expect clients to rely on the assumption that fields that start with an underscore are a meta field and expected to be returned directly as part of the hit? Regarding
Another question is whether we should always return the |
Currently, the same class `FieldCapabilities` is used both to represent the capabilities for one index, and also the merged capabilities across indices. To help clarify the logic, this PR proposes to create a separate class `IndexFieldCapabilities` for the capabilities in one index. The refactor will also help when adding `source_path` information in #49264, since the merged source path field will have a different structure from the field for a single index. Individual changes: * Add a new class IndexFieldCapabilities. * Remove extra constructor from FieldCapabilities. * Combine the add and merge methods in FieldCapabilities.Builder.
Currently, the same class `FieldCapabilities` is used both to represent the capabilities for one index, and also the merged capabilities across indices. To help clarify the logic, this PR proposes to create a separate class `IndexFieldCapabilities` for the capabilities in one index. The refactor will also help when adding `source_path` information in elastic#49264, since the merged source path field will have a different structure from the field for a single index. Individual changes: * Add a new class IndexFieldCapabilities. * Remove extra constructor from FieldCapabilities. * Combine the add and merge methods in FieldCapabilities.Builder.
Currently, the same class `FieldCapabilities` is used both to represent the capabilities for one index, and also the merged capabilities across indices. To help clarify the logic, this PR proposes to create a separate class `IndexFieldCapabilities` for the capabilities in one index. The refactor will also help when adding `source_path` information in #49264, since the merged source path field will have a different structure from the field for a single index. Individual changes: * Add a new class IndexFieldCapabilities. * Remove extra constructor from FieldCapabilities. * Combine the add and merge methods in FieldCapabilities.Builder.
It seems like this proposal would work for What is the expected behavior when the field is mapped with optional properties like |
Thanks for taking a look @wylieconlon !
This proposal centers on adding information about the field's path in |
Answering a couple questions asked over email:
I think we might still need an explicit indication that the field is an alias. Unless I'm missing something, the currently proposed API response wouldn't allow us to determine which fields are aliases and which are
I like how you're currently separating it out by index. Since we don't know of 100% of the places we'll need to use this info in Kibana, I think the more info the better. Aside from my |
@jtibshirani @jimczi Should we close this in favor of #49028? |
That works for me, we can always reopen if the idea becomes relevant again. |
Currently, the _field_caps API presents a transparent view of fields where aliases and multi-fields are not linked. However for some applications it is important to be able to retrieve the source field that was used to populate a specific field since the value of a sub-field (inside a multi-field) or an alias is not present in the
_source
. For this reason we have some duplicated logic in ml and sql that tries to infer the source path using some fragile heuristics. In order to simplify this retrieval this issue is a proposal to add asource_path
section to the fields inside thefield_caps
response. This way it would be easy for consumers of this API to redirect some fields to their source path when values need to be retrieved:This information should be easy to add for alias field and sub-fields inside a multi-field. It might be more problematic for
copy_to
since the target could have multiple source.The text was updated successfully, but these errors were encountered: