# Why I do not receive after\_key from my composite aggregation query?

**URL:** <https://discuss.elastic.co/t/why-i-do-not-receive-after-key-from-my-composite-aggregation-query/175482>\
**Category:** Elasticsearch\
**Created:** [April 4, 2019, 8:31pm UTC](https://discuss.elastic.co/t/why-i-do-not-receive-after-key-from-my-composite-aggregation-query/175482 "2019-04-04T20:31:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrei-galkin](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@andrei-galkin](https://discuss.elastic.co/u/andrei-galkin)\
**Post date:** [April 4, 2019, 8:31pm UTC](https://discuss.elastic.co/t/why-i-do-not-receive-after-key-from-my-composite-aggregation-query/175482/1 "2019-04-04T20:31:06Z")

</div>

Elastic search Version: 6.2.4.

My query

```
{
  "aggs": {
    "composite_agg": {
      "aggs": {
        "ActDate": {
          "max": {
            "field": "details.details.ActDate",
            "format": "yyyy'-'MM'-'dd'T'HH':'mm':'ss.SSSSSSSZZ"
          }
        }
      },
      "composite": {
        "size": 2,
        "sources": [
          {
            "OrgId": {
              "terms": {
                "field": "details.details.OrgId"
              }
            }
          }
        ]
      }
    }
  }
}

```

result

```
"aggregations": {
    "composite_agg": {
      "buckets": [
        {
          "key": {
            "OrgId": 16777217
          },
          "doc_count": 40,
          "ActDate": {
            "value": 1554408754291,
            "value_as_string": "2019-04-04T20:12:34.2910000+00:00"
          }
        },
        {
          "key": {
            "OrgId": 16777218
          },
          "doc_count": 1,
          "ActDate": {
            "value": 1554402199081,
            "value_as_string": "2019-04-04T18:23:19.0810000+00:00"
          }
        }
      ]
    }
  }

```

Why I do not receive after\_key to get more items. There are more items than I got in my query and this I see if I increase the size parameter.

---

<div class="post-metadata">

**Author:** ![andrei-galkin](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@andrei-galkin](https://discuss.elastic.co/u/andrei-galkin)\
**Post date:** [April 5, 2019, 3:07pm UTC](https://discuss.elastic.co/t/why-i-do-not-receive-after-key-from-my-composite-aggregation-query/175482/2 "2019-04-05T15:07:32Z")

</div>

This functionality will work on 6.3.\* or later version. Please check 6.2.\* manual [https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-aggregations-bucket-composite-aggregation.html](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-aggregations-bucket-composite-aggregation.html)

---

<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:** [May 3, 2019, 3:07pm UTC](https://discuss.elastic.co/t/why-i-do-not-receive-after-key-from-my-composite-aggregation-query/175482/3 "2019-05-03T15:07:32Z")

</div>

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