Filtering on aggregations

Hello,

I am doing a search operation to get some product results with their associated aggregations.
So , here, aggregations are by products of the search result
When I fetch this result, I ask for only 100 aggregations (this is just for our UI requirement)
On UI side, when I click on "next" button, I get 200 aggregations and so on.

Now, my requirement is to filter or search through the aggregations themselves.
For example, if I have 1000 aggregations on the index and If I ask for aggregations with substring "xyz", it should return all of the matching aggregations.

So,

  1. First, I need to perform search to get products. Because, I want to show them on UI. Along with products, I get their associated aggregations.
  2. Now, I want to search through ALL aggregations on the index (not just 100 or 200 but search through all of them) based on my search string.

Do we have any solution for this scenario?
Thank you in advance for your answer.

Hi @Navnath,

Welcome to the community! Can you share the aggregation you are running? I would have thought adding your query to the aggregation request would be the best way to go, similar to the below:

POST kibana_sample_data_flights/_search
{
  "query": {
    "range": {
      "timestamp": {
        "gte": "now-7d"
      }
    }
  },
  "aggs": {
    "destinations": {
      "terms": { "field": "DestCityName" },
      "aggs": {
        "carrier_buckets": {
          "terms": {
            "field": "Carrier"
          }
        }
      }
    }
  },
  "size": 0
}

Hope that helps!

Thank @carly.richmond for your answer. :slight_smile: