All results in aggregate ES5.x


(Pjanzen) #1

Hi,

In ES 2.x I was able to run an aggregate query with size 0 which give me all buckets. However in ES5.x this size must be set positive which is >= 1.

I have been reading the docs but I cannot figure out how to get all the results from for example the aggregate below. I hope someone can help.

Paul.

{
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "query": "_exists_:imp_to",
            "analyze_wildcard": true
          }
        },
        {
          "range": {
            "@timestamp": {
              "gte": 1481756400000,
              "lte": 1481813630636,
              "format": "epoch_millis"
            }
          }
        }
      ],
      "must_not": []
    }
  },
  "size": 0,
  "aggs": {
    "2": {
      "terms": {
        "field": "imp_to.keyword",
        "size": 1,
        "order": {
          "_count": "desc"
        }
      }
    }
  }
}

The result I now have is this.

{
  "took": 5444,
  "timed_out": false,
  "_shards": {
    "total": 8,
    "successful": 8,
    "failed": 0
  },
  "hits": {
    "total": 20082958,
    "max_score": 0,
    "hits": [

    ]
  },
  "aggregations": {
    "2": {
      "doc_count_error_upper_bound": 1461,
      "sum_other_doc_count": 20076219,
      "buckets": [
        {
          "key": "x-lxxxxxw@nabcded.com",
          "doc_count": 6739
        }
      ]
    }
  }
}

(system) #2

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