kskaradzinski
kskaradzinski

Reputation: 5084

Aggregations Size makes different results

I have simples aggregation like

  "aggs": {
    "firm_aggregation": {
      "terms": {
        "field": "experience.company_name.slug",
        "size": 10
      }
    }
  }

and this gives me result like

 "aggregations": {
        "firm_aggregation": {
            "buckets": [
                ... (some others)
                {
                    "key": "freelancer",
                    "doc_count": 33
                },

but when I increase aggregation size to 2000 i get

"aggregations": {
    "firm_aggregation": {
        "buckets": [
            ... (some others)
            {
                "key": "freelancer",
                "doc_count": 35
            },

why is this happening ?? I thouht that size will increase number of aggregations which elastic return.

Upvotes: 0

Views: 200

Answers (1)

Vineeth Mohan
Vineeth Mohan

Reputation: 19253

This is owing to the estimation done on shard level. For results of size 5 , only top 5 terms are taken from each shard and this is added to get the result. This need not be very accurate.

There is a very good explanation about this here.

Along with size , you can pass shard_size parameter which can control this behavior without affecting the data that is returned

Upvotes: 1

Related Questions