# Aggregations to show all values with filter

**URL:** <https://discuss.elastic.co/t/aggregations-to-show-all-values-with-filter/277591>\
**Category:** Elasticsearch\
**Created:** [July 1, 2021, 7:48pm UTC](https://discuss.elastic.co/t/aggregations-to-show-all-values-with-filter/277591 "2021-07-01T19:48:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![saiteja](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@saiteja](https://discuss.elastic.co/u/saiteja)\
**Post date:** [July 1, 2021, 7:48pm UTC](https://discuss.elastic.co/t/aggregations-to-show-all-values-with-filter/277591/1 "2021-07-01T19:48:37Z")

</div>

Hello,

I am trying to get all aggregations on specific field with filter same as exclude facet in solr  
If I run below query

```auto
GET /measurement/_search
{
  "query": {
    "query_string": {
      "query": "*"
    }
  },
  "aggs": {
    "my-agg-name": {
      "terms": {
        "field": "measurementName"
      }
    }
  }
}

```

i will get all docs with aggreations as below

```auto
"aggregations" : {
    "my-agg-name" : {
      "doc_count_error_upper_bound" : 0,
      "sum_other_doc_count" : 0,
      "buckets" : [
        {
          "key" : "acrd",
          "doc_count" : 2
        },
        {
          "key" : "acrd1",
          "doc_count" : 1
        },
        {
          "key" : "acrd2",
          "doc_count" : 1
        },
        {
          "key" : "acrd3",
          "doc_count" : 1
        }
      ]
    }
  }

```

even with filter query i need aggregations as above

```auto
GET /measurement/_search
{
  "query": {
    "query_string": {
      "query": "ACRD1"
    }
  },
  "aggs": {
    "my-agg-name": {
      "terms": {
        "field": "measurementName"
      }
    }
  }
}

```

User will see only specific docs but must be able to see all aggregation values for the field measurementName

I have implemented in solr with exclude facets and trying to do same in elastic search.

---

<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 29, 2021, 7:48pm UTC](https://discuss.elastic.co/t/aggregations-to-show-all-values-with-filter/277591/2 "2021-07-29T19:48:50Z")

</div>

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