-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Fix date and ip sources in the composite aggregation #29370
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
Conversation
This commit fixes the formatting of the values in the composite aggregation response. `date` fields should return timestamp as longs when used in a `terms` source and `ip` fields should always be formatted as strings. This commit also fixes the parsing of the `after` key for these field types. Finally, this commit disables the index optimization for the `ip` field and any source that provides a `missing` value.
Pinging @elastic/es-search-aggs |
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.
Looks good in general, I'm just curious why we still use the RAW format with dates in some cases.
final DocValueFormat format; | ||
if (format() == null && fieldType instanceof DateFieldMapper.DateFieldType) { | ||
// defaults to the raw format on date fields (preserve timestamp as longs). | ||
format = DocValueFormat.RAW; |
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.
why shouldn't we use the format from the mapping?
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.
That's a good question. In 6.2 we always return the raw value and there is no distinction in this aggregation to return getKey
or getKeyAsString
since the returned object is a map. So I think it's preferable to return the raw value unless a format
has been specified.
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 see. for the record we'll probably need to change this anyway one day for #18518
This commit fixes the formatting of the values in the composite aggregation response. `date` fields should return timestamp as longs when used in a `terms` source and `ip` fields should always be formatted as strings. This commit also fixes the parsing of the `after` key for these field types. Finally, this commit disables the index optimization for the `ip` field and any source that provides a `missing` value.
This is good. |
This commit fixes the formatting of the values in the composite aggregation response.
date
fields should return timestamp as longs when used in aterms
source andip
fields should always be formatted as strings.This commit also fixes the parsing of the
after
key for these field types.Finally, this change disables the index optimization for the
ip
field and any source that provides amissing
value.