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

Percentiles aggregation on histogram-type field of an object fails #51847

Closed
axw opened this issue Feb 4, 2020 · 4 comments · Fixed by #51920
Closed

Percentiles aggregation on histogram-type field of an object fails #51847

axw opened this issue Feb 4, 2020 · 4 comments · Fixed by #51920

Comments

@axw
Copy link
Member

axw commented Feb 4, 2020

Elasticsearch version (bin/elasticsearch --version): 7.6.0 BC3

Version: 7.6.0, Build: default/docker/d90e0399161efda5d2386d9a1376ce1a11c070c6/2020-01-29T17:39:50.161706Z, JVM: 13.0.2

Plugins installed: None

JVM version (java -version):

openjdk version "13.0.2" 2020-01-14
OpenJDK Runtime Environment AdoptOpenJDK (build 13.0.2+8)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13.0.2+8, mixed mode, sharing)

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

Linux f693bd1687ce 4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

(Running in Docker, FWIW.)

Description of the problem including expected versus actual behavior:

Using the new histogram field type, there seems to be differing behaviour when the field exists at the top level vs. as a field of another object. In particular, a percentiles aggregation works as expected on a top-level histogram field, but returns null for a histogram field within another object.

Steps to reproduce:

  1. Create index mapping like so:
PUT /example
{
    "mappings": {
        "properties": {
            "foo": {
              "properties": {
                "bar": {
                  "type": "histogram"
                },
                "baz": {
                  "type": "double"
                }
              }
            },
            "qux": {
              "type": "histogram"
            }
        }
    }
}
  1. Index some data:
POST /example/_doc
{
    "foo" : {
      "bar": {
        "values": [1, 2, 3, 4, 5],
        "counts": [1, 2, 3, 4, 5]
      },
      "baz": [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]
    },
    "qux": {
      "values": [1, 2, 3, 4, 5],
      "counts": [1, 2, 3, 4, 5]
    }
}
  1. Run percentiles aggregation on each of foo.bar, foo.baz, and qux
GET /example/_search
{
  "size": 0,
  "aggs": {
    "percentiles_object_field_histogram": {
      "percentiles": {
        "field": "foo.bar",
        "percents": [1, 5, 25, 50, 75, 95, 99]
      }
    },
    "percentiles_individual_data": {
      "percentiles": {
        "field": "foo.baz",
        "percents": [1, 5, 25, 50, 75, 95, 99]
      }
    },
    "percentiles_top_level_histogram": {
      "percentiles": {
        "field": "qux",
        "percents": [1, 5, 25, 50, 75, 95, 99]
      }
    }
  }
}

Output:

{
  "took" : 0,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  },
  "aggregations" : {
    "percentiles_individual_data" : {
      "values" : {
        "1.0" : 1.0,
        "5.0" : 1.25,
        "25.0" : 3.0,
        "50.0" : 4.0,
        "75.0" : 5.0,
        "95.0" : 5.0,
        "99.0" : 5.0
      }
    },
    "percentiles_top_level_histogram" : {
      "values" : {
        "1.0" : 1.0,
        "5.0" : 1.1666666666666667,
        "25.0" : 2.7,
        "50.0" : 3.857142857142857,
        "75.0" : 4.722222222222222,
        "95.0" : 5.0,
        "99.0" : 5.0
      }
    },
    "percentiles_object_field_histogram" : {
      "values" : {
        "1.0" : null,
        "5.0" : null,
        "25.0" : null,
        "50.0" : null,
        "75.0" : null,
        "95.0" : null,
        "99.0" : null
      }
    }
  }
}

I expect them all to succeed.

@cbuescher cbuescher added the :Analytics/Aggregations Aggregations label Feb 4, 2020
@elasticmachine
Copy link
Collaborator

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

@polyfractal
Copy link
Contributor

/cc @iverase

@axw Were there any error messages / stack traces from the server? Or just the null values in the response?

@axw
Copy link
Member Author

axw commented Feb 5, 2020

@polyfractal nope, nothing - just the null values.

@iverase
Copy link
Contributor

iverase commented Feb 5, 2020

Great catch! The issue is that we are generating the doc values using the simple name instead of the fully qualified name.

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.

5 participants