Elasticsearch determinte bucket length in aggregation

please help me with understanding nested bucket aggregation in elastic search. I have next query aggregation results:

 [...]
{
  "key": "key1",
  "doc_count": 1166,
  "range_keys": {
    "doc_count_error_upper_bound": 0,
    "sum_other_doc_count": 0,
    "buckets": [
      {
        "key": "happy",
        "doc_count": 1166
      }
    ]
  }
},
{
  "key": "key2",
  "doc_count": 1123,
  "range_keys": {
    "doc_count_error_upper_bound": 0,
    "sum_other_doc_count": 0,
    "buckets": [
      {
        "key": "cookies",
        "doc_count": 1122
      },
      {
        "key": "happy",
        "doc_count": 1
      }
    ]
  }
},

[...]

As you see, i have query results with only "happy", but i need to get all results only with "happy" and "cookies".

In order to achieve this goal i tried to use "size" argument, but this argument gave e results with size and less results query.

How i can determine "bucket" length in nested query?

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