-
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
Introduce contract to know whether InternalAggs have computed results or not #34903
Comments
Pinging @elastic/es-search-aggs |
Whilst I agree that this is something that we should think about solving in a general way, especially as it has come up before when dealing with pipeline aggregations I am wondering if in the short term #34896 could be solved by looking at the doc_count of the parent aggregation bucket (or total.hits if the agg is already a root aggregation) since this would determine with accuracy if the aggregation received any data? One other thing to note here is that the Sum of no values is |
@colings86 may I ask why A |
It works this way because |
It would work but it requires knowledge about the agg structure (its parent) in the consumer. This information can be encapsulated in the agg itself and in a good number of metric aggs it already is (to properly report values as null in |
A related issue that will need addressing is how this interacts with pipeline aggs, as also discovered by Costin. E.g. when pipelines resolve agg values, they get the primitive internal state from the agg. This means that pipelines like I think this can be fixed by providing the eventual mechanism ( Note: this is related to #27377 although somewhat different. |
It's a common concern for aggregations to not compute any results (empty bucket or null values) yet there is no general way to discover that when interacting with them. One needs to look into their internals but even then there are aggs where it's ambiguous whether any computation has happened or if it's just the default value (as aggs use primitives, there's no
null
).Take
SUM
andMAX
; if there's nothing to compute,SUM
returns0
whileMAX
returnsDouble.POSITIVE_INFINITY
. The latter might be used but0
is a valid sum so the caller has no idea whether its meaning isnull
or actually0
.See #34896
The text was updated successfully, but these errors were encountered: