percentitles aggregation in Elastic Search just gives percentile value as whatever is given in missing parameter

21 Views Asked by At

I just simplified my query as this

GET /index-name/_search
{
  "from": 0,
  "query": {
    "bool": {
      "filter": [
        {
          "terms": {
            "providerid": [
              2000019314,
              2000041586,
              2000060152
            ]
          }
        }
      ]
       
    }
  },
   "aggs": {
    "quality_score_percentiles": {
      "percentiles": {
        "field": "metrics.data.weightedqualityscore",
        "percents": [50,75],
        "missing": 10
      }
    }
  },
  "size": 10
}

I get 3 documents in response hits for given 3 providerId. Each of this documents has weightedqualityscore as 71, 72 and 67 respectively. Mapping in Index : weightedqualityscore is float field in index mapping.

      "metrics" : {
            "type" : "nested",
            "properties" : {
              "data" : {
                "properties" : {
                 "weightedqualityscore" : {
                    "type" : "float"
                  },
                  "weightedspeedscore" : {
                    "type" : "float"
                  }
                }
              }
           }
      }

My aggreagation response just displays value as 10 ( or whatever I give in missing param in query) as below But my expected 75th percentile value is 71.75 with this data.

"aggregations" : {
    "quality_score_percentiles" : {
      "values" : {
        "50.0" : 10.0,
        "75.0" : 10.0
      }
    }
  }

Both 50th percentile and 75th percentile are incorrect values. What is incorrect or missing in the query to correctly calculate 75th percentile?

0

There are 0 best solutions below