-
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
Consider adding field alias information to field caps. #44298
Comments
Pinging @elastic/es-search |
Tagging @elastic/kibana-app-arch and @elastic/es-sql for their thoughts on the proposal. |
We have the same issues with multi
I think the same information could be used internally to support highlighting on aliases and multi-fields? |
I can't speak for the Kibana team but I think both approaches could work. The part I like about the approach proposed by @jpountz is that it seems to be just an extension of the existing Metadata about the field and it works not only for alias. |
We discussed this issue in the Search meeting and decided to implement the approach proposed by Julie and Adrien (adding |
When used in a search, field aliases have some limitations compared to concrete fields (as described in unsupported APIs). One important limitation is that field aliases do not appear in the document
_source
, and so their values cannot be retrieved through_source
filtering.For this reason, applications may need to add special handling for field aliases when working with the
_source
from search results. Currently, the_field_caps
API presents a completely transparent view of field aliases -- requesting field caps for an alias will return the same output as if it were mapped as a concrete field. One proposal is to include a newaliases
section that indicates the field is an alias, and gives information about its target:To me this seems like an acceptable addition to field caps and is not just creating a 'leaky abstraction'. The fact that a field is an alias has an impact on its capabilities, and an application may want to add special handling for this case.
Motivation
ES SQL currently loads field values from
doc_values
, but is exploring loading some values from_source
(#44062). If a field alias is specified, SQL needs to understand that it is an alias in order to either fall back todoc_values
, or resolve it to its target in order to extract its value from_source
. ES SQL uses field caps to retrieve information about fields across indices/ clusters, and does not have knowledge of the original field mappings.In Kibana's Discover app, field aliases currently do not show up on the left-hand panel or in the body of search results, because this data is pulled directly from
_source
. Having knowledge of field aliases in the index pattern could allow Kibana to show the aliases associated with concrete fields in the documents (elastic/kibana#28570). Kibana index patterns pull information from field caps, so this could be a helpful addition to the API.Alternative approaches
Another approach would be to try to take field aliases into account when filtering and returning
_source
. To me this seems more confusing from an API perspective:"my_object.*"
look up matching field aliases and try to include their targets in the returned_source
? Or is it interpreted as just taking the_source
and filtering out the parts that don't match"my_object.*"
?_source
. We do not want to modify or rewrite_source
because it should represent exactly what was provided when indexing the document.The text was updated successfully, but these errors were encountered: