-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Bolster field value retrieval in Top Hits metric agg #11141
Comments
I think it is safe to assume that |
We discussed this a lot during the original top hits PR, it's complicated... Here's another suggestion: the |
Why |
I'd like to understand more about the background of this issue. For instance why don't you just request the field via Also I'm wondering what would be wrong with doing something like this:
|
Yeah, _source might be disabled. Or we might prefer the normalized version of the field value rather than the original _source value, like with dates for instance. I also assume it is faster. It might be negligible in most cases since we're only pulling back one or a few documents, but some users have pretty massive docs where it might make a difference.
I think that would work fine at the moment, but I do agree with @spalger that field access is really complicated right now. For one, things keep changing. Extracting the field value from the response is also complicated by the number of options available. So there are a lot of variables that hinge on the choice between |
@Bargs sorry, missed these responses, re: #11141 (comment) It was supposed to be |
Closing this because it's not planned to be resolved in the foreseeable future. It will be tracked in our Icebox and will be re-opened if our priorities change. Feel free to re-open if you think it should be melted sooner. |
The
top_hits
metric is currently checkingfield.doc_values
to see if it needs to ask for the field's value viadocvalue_fields
. This strategy covers the majority of use cases, but with the move to the_field_caps
APIfield.doc_values
will no longer be available. Additionally, there are other field value storage schemes beyond_source
anddoc_values
that this doesn't account for.For now the plan is to change the condition to
aggregatable && type !== "text"
and store the value atfield.readFromDocValues
(or something similar). This condition isn't terrible, it also works in the majority of scenarios, but it holds a lot of assumptions about whataggregatable
means. Should the definition of aggregatable shift, or the default behavior for certain types change, this condition could very well become a problem. We probably can't depend on it long term.We should probably see how elastic/elasticsearch#24036 plays out before moving forward, but if that ticket doesn't lead anywhere we need to consider other options.
The text was updated successfully, but these errors were encountered: