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

Precision loss of include/exclude filter values in terms aggregation #38692

Closed
cyberhuman opened this issue Feb 11, 2019 · 2 comments · Fixed by #49063
Closed

Precision loss of include/exclude filter values in terms aggregation #38692

cyberhuman opened this issue Feb 11, 2019 · 2 comments · Fixed by #49063

Comments

@cyberhuman
Copy link

cyberhuman commented Feb 11, 2019

Elasticsearch version (bin/elasticsearch --version):
6.4.2

Plugins installed: []

JVM version (java -version):

openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-2~deb9u1-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)

OS version (uname -a if on a Unix-like system):

Linux 4.18.0-2-amd64 #1 SMP Debian 4.18.10-2 (2018-10-07) x86_64 GNU/Linux

Description of the problem including expected versus actual behavior:
When trying to filter the values for which buckets are created when using terms aggregation on a long field, it's not possible to use values larger than 53 bits. When specifying one in a list of include values, no bucket is created most of the time, and when specifying one in a list of exclude values, the respective bucket is not excluded. I expect that for fields of the long type, the full 64 bit range works.

Steps to reproduce:

Please include a minimal but complete recreation of the problem, including
(e.g.) index creation, mappings, settings, query etc. The easier you make for
us to reproduce it, the more likely that somebody will take the time to look at it.

  1. PUT /test '{"mappings":{"_doc":{"properties":{"field1":{"type":"long"}}}}}'
  2. POST /test/_doc '{"field1":0}'
  3. POST /test/_doc '{"field1":123456}'
  4. POST /test/_doc '{"field1":4094779560956318341}'
  5. POST /test/_doc/_search '{"size":0,"aggs":{"by_field1":{"terms":{"field":"field1","include":[0,123456,4094779560956318341]}}}} returns only buckets for 0 and 123456
  6. POST /test/_doc/_search '{"size":0,"aggs":{"by_field1":{"terms":{"field":"field1","exclude":[0,123456,4094779560956318341]}}}} returns only bucket for 4094779560956318341

Provide logs (if relevant):

The reason is apparently here:
https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/IncludeExclude.java#L633-L642
and here:
https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/search/DocValueFormat.java#L118-L126

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo

@matriv
Copy link
Contributor

matriv commented Feb 11, 2019

It's reproducable on 6.4.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants