Aggregations to show all values with filter

Hello,

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

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

i will get all docs with aggreations as below

"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

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.

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