-
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
Aggregations and counter field support. #93587
Conversation
No longer offer limited aggregation support counter fields. This extends the counter field support to all aggregation. Closes elastic#93539
13b03b0
to
47123c6
Compare
Hi @martijnvg, I've created a changelog YAML for you. |
Pinging @elastic/es-analytics-geo (Team:Analytics) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the wrong thing to do. This is intended to work around a "bad" user experience, but it does so by creating a worse user experience. This change says that things we know yield garbage results are explicitly and intentionally supported. We've done this before to work around UX issues, and gotten pretty badly burned. I'm thinking of terms sort ascending, which we know produces unbounded error (read as "utter garbage results that shouldn't be used for any purpose"), and yet it continues to get wide use. This is inviting the same kind of mistake, and I cannot in good faith approve it.
Strong 👎🏼
public static List<ValuesSourceType> ALL_CORE = Arrays.asList(CoreValuesSourceType.values()); | ||
public static final List<ValuesSourceType> ALL_CORE = List.of(CoreValuesSourceType.values()); | ||
public static final List<ValuesSourceType> ALL_NUMERIC = List.of(NUMERIC, COUNTER); | ||
public static final List<ValuesSourceType> ALL_NUMERIC_LENIENT = List.of(NUMERIC, COUNTER, DATE, BOOLEAN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've heard that leniency is abhorrent, and should be eschewed. I deeply do not like having these lists. I probably shouldn't have even added ALL_CORE
when first doing this, and I definitely don't want to proliferate them. Yes, it's more typing to have to list them out at registration time, but it makes it much clearer exactly what we mean.
Registration is write once, read many times. I would like to optimize for not needing to click through to the list definition every time to see exactly what types are included. I would also like for people adding new types to have to explicitly think about what aggregations should be supported.
Thinking more about this, if we absolutely must include this to make the UI work correctly, we should write new aggregators that always return a constant (e.g. |
I agree that neither option is great. If we're lenient, we're most likely returning nonsensical results to the user. If we're strict, users could get frustrated that Elasticsearch artificially refuses to run a computation that they want to run. The following other factors come to mind:
I dislike the cons either way, and wonder if we could find something in-between. Thinking out loud, I have the following in mind at the moment:
I like that it would still let users know in case they queries disagree with their mappings regarding the fact that a field is a counter, which is what I like with the strict option, while still allowing users to run arbitrary aggregations, which is what I like about the lenient option. |
This is what we want to do, this PR is trying to work around the issue that the Kibana integration is not ready for technical preview in 8.7. @thomasneirynck keep me honest here but my opinion is, if we are uncomfortable with this stop-gap measure then we need to revert this out of 8.7 and take 8.8 to provide the right experience in Kibana. Trying to fix this in the UI post feature freeze is high risk and a poor experience. |
agreed @timductive . I don't think there will be an appropriate stop-gap measure we can do that would be fit for a post-FF 8.7 release. The one we had discussed ( The other alternative, suggested by @jpountz: wrt:
To do this right is imho beyond what we can do as a bug fix for 8.7. |
@martijnvg and I discussed this offline. We are hesitant to merge this PR because it introduces wrong functionality. For 8.7, we do need to fix the downstream UX effects of aggs not working (ie. errors in Lens, ML, Maps elastic/kibana#148518) Kibana team will put a PR that sets Post 8.7, we need to work on a more integrated solution. Some thoughts around this: Elasticsearch adds in field_caps which aggregations are compatible with which field-types, and Kibana acts accordingly. |
All @jughosta Notes -
You can quickly test this with kibana_sample_data_logs where bytes_counter has time_series_metric data in index mapping but DataViewField does not get this info. I'm unclear about the usefulness of |
Ok, we can change the field caps api to always return |
@martijnvg Are you looking into that for 8.7? |
Yes. |
Closing this PR. The conclusion is that field caps api should tell more than whether a field is aggregatable. Field caps and search APIs don't have the notion of value source types and this is an internal Elasticsearch abstraction. So it doesn't make sense to expose value source type. Maybe the field caps api should just return a list of supported aggregations per field. We will investigate this. In the meantime Kibana will not counter fields as aggregatable. |
No longer offer limited aggregation support counter fields.
This extends the counter field support to all aggregation.
Unfortunately I didn't see a way to automatically register aggregators for counter fields and numeric fields at the same time.
The rate aggregation does need the distinction between an aggregator for counter and numeric fields. And implicit logic in
ValuesSourceRegistry.Builder#register(...)
method seems trappy.This change registers many aggregators for both numeric and counter value types. Introduced a constants to make registering a bit easier.
Closes #93539