# Aggregate \_index with terms?

**URL:** <https://discuss.elastic.co/t/aggregate--index-with-terms/82109>\
**Category:** Kibana\
**Created:** [April 12, 2017, 7:46am UTC](https://discuss.elastic.co/t/aggregate--index-with-terms/82109 "2017-04-12T07:46:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://discuss.elastic.co/u/bluepuma77)\
**Post date:** [April 12, 2017, 7:46am UTC](https://discuss.elastic.co/t/aggregate--index-with-terms/82109/1 "2017-04-12T07:46:03Z")

</div>

In Kibana 5.2.2 I created an index pattern `news-*`. Now I would like to filter for `language:english` and show counts split up by real index names.

I thought about using the terms aggregation, but it only includes "internal" `_type`, but not `_index`. Is there a way to aggregate over `_index` in Kibana?

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [April 12, 2017, 11:33pm UTC](https://discuss.elastic.co/t/aggregate--index-with-terms/82109/2 "2017-04-12T23:33:41Z")

</div>

Hi

With \_index, elasticsearch tells kibana, aggregating and searching on \_index is not allowed as by default as it has no index property. If you have `index.raw` in your field mappings then you can aggregate over that field.

In my simple experiment I tried this .

```auto
{
  "logstash-0" : {
    "mappings" : {
      "_default_" : {
        "dynamic_templates" : [
          {
            "string_fields" : {
              "match" : "*",
              "match_mapping_type" : "string",
              "mapping" : {
                "fields" : {
                  "raw" : {
                    "type" : "keyword"
                  }
                },
                "type" : "text"
              }
            }
          }
        ],

```

 ![](https://us1.discourse-cdn.com/elastic/original/3X/9/8/98fff7b99ba09e4de06f9860a33677143a12df51.png) You could use something like that.

also there is a ref ticket you could get more info on [https://github.com/elastic/kibana/issues/4027](https://github.com/elastic/kibana/issues/4027)

Hope this helps.

---

<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 10, 2017, 11:37pm UTC](https://discuss.elastic.co/t/aggregate--index-with-terms/82109/3 "2017-05-10T23:37:33Z")

</div>

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