# Percentiles aggregation yield different results between ES 1.7.x and 7.x

**URL:** <https://discuss.elastic.co/t/percentiles-aggregation-yield-different-results-between-es-1-7-x-and-7-x/206954>\
**Category:** Elasticsearch\
**Created:** [November 7, 2019, 11:17am UTC](https://discuss.elastic.co/t/percentiles-aggregation-yield-different-results-between-es-1-7-x-and-7-x/206954 "2019-11-07T11:17:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![joneslee85](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joneslee85/32/20980_2.png) [@joneslee85](https://discuss.elastic.co/u/joneslee85)\
**Post date:** [November 7, 2019, 11:17am UTC](https://discuss.elastic.co/t/percentiles-aggregation-yield-different-results-between-es-1-7-x-and-7-x/206954/1 "2019-11-07T11:17:54Z")

</div>

Let's create 3 products with sale\_counts field:

```auto
PUT products/_mapping
{
  "properties": {
    "sales_count": {
      "type": "integer"
    }
  }
}

```

```auto
POST products/_doc/
{
  "sales_count" : 323,
}

```

```auto
POST products/_doc/
{
  "sales_count" : 323,
}

```

```auto
POST products/_doc/
{
  "sales_count" : 1000,
}

```

let's build sale percentiles aggregation bucket:

```auto
POST products/_search
{
  "query": {
    "bool": {
      "must": {
        "match_all": {}
      },
      "filter": []
    }
  },
  "aggregations": {
    "sales_percentiles": {
      "percentiles": {
        "field": "sales_count",
        "percents": [
          50,
          95,
          99
        ]
      }
    }
  },
  "from": 0,
  "size": 50,
  "timeout": "3000ms"
}

```

results are:

```auto
# ES 1.7.5
...
"aggregations": {
  "sales_percentiles": { "values": { "50.0": 323,"95.0": 932.3,"99.0": 1000}}
}

```

```auto
# ES 7.1.1
...
"aggregations": {
	"sales_percentiles": { "values": { "50.0": 323,"95.0": 1000,"99.0": 1000}}
}

```

the 95th percentile value is not the same between 2 ES versions.

I would like to ask if this is a bug.

Much thanks

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [November 7, 2019, 11:22am UTC](https://discuss.elastic.co/t/percentiles-aggregation-yield-different-results-between-es-1-7-x-and-7-x/206954/2 "2019-11-07T11:22:17Z")

</div>

Given that you have so few samples I would expect the response in ES7 and suspect it may be a bug in ES1.7. I can’t see how 932 could ever be an expected value there.

---

<div class="post-metadata">

**Author:** ![joneslee85](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joneslee85/32/20980_2.png) [@joneslee85](https://discuss.elastic.co/u/joneslee85)\
**Post date:** [November 7, 2019, 12:27pm UTC](https://discuss.elastic.co/t/percentiles-aggregation-yield-different-results-between-es-1-7-x-and-7-x/206954/3 "2019-11-07T12:27:18Z")

</div>

I think so too.

Thanks for confirming the hypothesis.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 5, 2019, 12:27pm UTC](https://discuss.elastic.co/t/percentiles-aggregation-yield-different-results-between-es-1-7-x-and-7-x/206954/4 "2019-12-05T12:27:21Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
