Skip to content
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

Fix date_nanos in composite aggs #53315

Merged
merged 4 commits into from
Mar 10, 2020
Merged

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Mar 9, 2020

It looks like date_nanos fields weren't likely to work properly in
composite aggs because composites iterate field values using points and
we weren't converting the points into milliseconds. Because the doc
values were coming back in milliseconds we ended up geting very confused
and just never collecting sub-aggregations.

This fixes that by adding a method to DateFieldMapper.Resolution to
parsePointAsMillis which is similarly in name and function to
NumberFieldMapper.NumberType's parsePoint except that it normalizes
to milliseconds which is what aggs need at the moment.

Closes #53168

It looks like `date_nanos` fields weren't likely to work properly in
composite aggs because composites iterate field values using points and
we weren't converting the points into milliseconds. Because the doc
values were coming back in milliseconds we ended up geting very confused
and just never collecting sub-aggregations.

This fixes that by adding a method to `DateFieldMapper.Resolution` to
`parsePointAsMillis` which is similarly in name and function to
`NumberFieldMapper.NumberType`'s `parsePoint` except that it normalizes
to milliseconds which is what aggs need at the moment.

Closes elastic#53168
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (:Analytics/Aggregations)

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, LGTM
thanks @nik9000

@nik9000 nik9000 merged commit a63232d into elastic:master Mar 10, 2020
nik9000 added a commit to nik9000/elasticsearch that referenced this pull request Mar 10, 2020
It looks like `date_nanos` fields weren't likely to work properly in
composite aggs because composites iterate field values using points and
we weren't converting the points into milliseconds. Because the doc
values were coming back in milliseconds we ended up geting very confused
and just never collecting sub-aggregations.

This fixes that by adding a method to `DateFieldMapper.Resolution` to
`parsePointAsMillis` which is similarly in name and function to
`NumberFieldMapper.NumberType`'s `parsePoint` except that it normalizes
to milliseconds which is what aggs need at the moment.

Closes elastic#53168
nik9000 added a commit that referenced this pull request Mar 11, 2020
It looks like `date_nanos` fields weren't likely to work properly in
composite aggs because composites iterate field values using points and
we weren't converting the points into milliseconds. Because the doc
values were coming back in milliseconds we ended up geting very confused
and just never collecting sub-aggregations.

This fixes that by adding a method to `DateFieldMapper.Resolution` to
`parsePointAsMillis` which is similarly in name and function to
`NumberFieldMapper.NumberType`'s `parsePoint` except that it normalizes
to milliseconds which is what aggs need at the moment.

Closes #53168
nik9000 added a commit to nik9000/elasticsearch that referenced this pull request Mar 11, 2020
Now that we've backported elastic#53315 we can run the backwards compatibility
tests against it.
nik9000 added a commit that referenced this pull request Mar 11, 2020
Now that we've backported #53315 we can run the backwards compatibility
tests against it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

composite agg fails to bucket date_nanos with date_histogram source
4 participants