# Aggregation error: Could not find aggregator type in \[aggs\]

**URL:** <https://discuss.elastic.co/t/aggregation-error-could-not-find-aggregator-type-in-aggs/90367>\
**Category:** Elasticsearch\
**Created:** [June 21, 2017, 9:49pm UTC](https://discuss.elastic.co/t/aggregation-error-could-not-find-aggregator-type-in-aggs/90367 "2017-06-21T21:49:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xwang1](https://avatars.discourse-cdn.com/v4/letter/x/ed8c4c/32.png) [@xwang1](https://discuss.elastic.co/u/xwang1)\
**Post date:** [June 21, 2017, 9:49pm UTC](https://discuss.elastic.co/t/aggregation-error-could-not-find-aggregator-type-in-aggs/90367/1 "2017-06-21T21:49:41Z")

</div>

I am having some trouble with multiple aggregations in elasticsearch. I am trying to first find all documents whose value for "field\_0" is "a\_string" and then aggregate twice on those docs based on the fields "field\_1" and "field\_2". This is the code I used:

```auto
GET logstash-*/_search?size=0
{
  "query": {
    "match_phrase": {
      "field_0": "a_string"
    }
  },
  "aggs": {
    "name_0": {
      "terms": {
        "field": "field_1"
      }
    },
    "aggs": {
      "name_1": {
        "terms": {
          "field": "field_2"
        }
      }
    }
  }
}

```

When I ran the code this was the error message:

```auto
{
  "error": {
    "root_cause": [
      {
        "type": "parsing_exception",
        "reason": "Could not find aggregator type [name_1] in [aggs]",
        "line": 14,
        "col": 17
      }
    ],
    "type": "parsing_exception",
    "reason": "Could not find aggregator type [name_1] in [aggs]",
    "line": 14,
    "col": 17
  },
  "status": 400
}

```

I have basically no clue why this error appears - when I run the aggregation with just "field\_1" it works just fine. Any help with resolving this error is greatly appreciated.

---

<div class="post-metadata">

**Author:** ![xwang1](https://avatars.discourse-cdn.com/v4/letter/x/ed8c4c/32.png) [@xwang1](https://discuss.elastic.co/u/xwang1)\
**Post date:** [June 21, 2017, 9:57pm UTC](https://discuss.elastic.co/t/aggregation-error-could-not-find-aggregator-type-in-aggs/90367/2 "2017-06-21T21:57:45Z")

</div>

Nevermind, I found the reason - my second aggregation should be parallel to terms and under name\_0, the issue is now resolved.

---

<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:** [July 19, 2017, 9:58pm UTC](https://discuss.elastic.co/t/aggregation-error-could-not-find-aggregator-type-in-aggs/90367/3 "2017-07-19T21:58:16Z")

</div>

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