# Alternative for flags in terms aggregation

**URL:** <https://discuss.elastic.co/t/alternative-for-flags-in-terms-aggregation/42062>\
**Category:** Elasticsearch\
**Created:** [February 17, 2016, 6:26pm UTC](https://discuss.elastic.co/t/alternative-for-flags-in-terms-aggregation/42062 "2016-02-17T18:26:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![apanimesh061](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/apanimesh061/32/927_2.png) [@apanimesh061](https://discuss.elastic.co/u/apanimesh061)\
**Post date:** [February 17, 2016, 6:26pm UTC](https://discuss.elastic.co/t/alternative-for-flags-in-terms-aggregation/42062/1 "2016-02-17T18:26:11Z")

</div>

Following is the `aggregation` query valid in ES 1.4:

```
"aggregations": {
  "links": {
    "terms": {
      "script": "<user_defined_script>",
      "size": 0,
      "shard_size": 0,
      "include": {
        "pattern": "<user_defined_pattern>",
        "flags": 2
      }
    }
  }
}

```

Following is the same query that I used in ES 2.1.1:

```
"aggregations": {
  "links": {
    "terms": {
      "script": {
        "inline": "<user_defined_script>"
      },
      "size": 0,
      "shard_size": 0,
      "include": {
        "pattern": "<user_defined_pattern>",
        "flags": 2
      }
    }
  }
}

```

but I noticed that `flags` has been removed from ES 2.0+ releases.

So, are there any alternatives in ES 2.0+ for such an aggregation?

---

<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 5, 2017, 11:15pm UTC](https://discuss.elastic.co/t/alternative-for-flags-in-terms-aggregation/42062/2 "2017-07-05T23:15:35Z")

</div>


