Skip to content

Replace aggregation key with formatted values #18518

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

Closed
jpountz opened this issue May 23, 2016 · 8 comments
Closed

Replace aggregation key with formatted values #18518

jpountz opened this issue May 23, 2016 · 8 comments
Assignees
Labels
:Analytics/Aggregations Aggregations >breaking >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)

Comments

@jpountz
Copy link
Contributor

jpountz commented May 23, 2016

Many aggregations provide two representations of aggregated values, such as key and key_as_string in terms/histogram aggregations. This is annoying because this is duplicate information and the key return value leaks the internal representation of data in doc values. For instance this forced us to break the response of terms or range aggregations on ip fields when we added ipv6 support since we do not store ip addresses in a number anymore. We should return a single key parameter and drop key_as_string.

@cbuescher
Copy link
Member

As a note, key_as_string however is currently used for formatting utc keys for date histograms according to the time zone specified for rounding in the query. We introduced this back in #9710, if we remove this every bucket key needs to be converted to the appropriate time zone on the user side to display the correct local time on the buckets.

@colings86
Copy link
Contributor

@jpountz is this still something you think we should do?

/cc @elastic/es-search-aggs

@jakelandis jakelandis removed the v7.2.0 label Jun 17, 2019
@jpountz jpountz removed the v7.3.0 label Jul 5, 2019
@rjernst rjernst added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label May 4, 2020
@nik9000
Copy link
Member

nik9000 commented Jun 23, 2021

@jpountz reviving this, maybe, do you think we should just return the string valued keys? Not the "native" keys?

@jpountz
Copy link
Contributor Author

jpountz commented Jun 23, 2021

@nik9000 Yes, we shouldn't leak the internal representation of the data to our users. It makes the API look ugly and makes changing the way our field types are implemented breaking. Ideally we would make keys go through MappedFieldType#docValuesFormat like we do with docvalue_fields?

@nik9000
Copy link
Member

nik9000 commented Jun 23, 2021

Got it.

@nik9000 nik9000 changed the title Remove *_as_string from the output of aggregations Replace aggregation key with formatted values Jun 23, 2021
@not-napoleon
Copy link
Member

Related (possibly a dup of) #63898

@mitar
Copy link
Contributor

mitar commented Oct 26, 2022

I thin it would be better if one could choose between internal representation, key_as_string, or some other formatting. For us, we prefer internal representation and as little of changes to the key as possible. (We use then key values to construct filters and so we can pass values as-is.)

@wchaparro
Copy link
Member

closing as not planned.

@wchaparro wchaparro closed this as not planned Won't fix, can't repro, duplicate, stale Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Aggregations Aggregations >breaking >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)
Projects
None yet
Development

No branches or pull requests