0

I'm wondering if ElasticSearch has an aggregation that returns whether or not a field has any terms (i.e. if the terms aggregation will return an empty list or not). Obviously I can use a terms aggregation and check if there are any results, but I was wondering if there is something cheaper.

Robert Wille
  • 189
  • 1
  • 12
  • looks like you are trying to do boolean (field has term or not), can we use terms filter for your case? – deerawan Jun 12 '18 at 06:29
  • The use case is like this: the user performs a search. Along with the search results, I want to display a list of the fields that he/she could display facets for. If a particular field has no terms in the search results, I don't want to display that field, as it is a poor UI to display an option that does nothing. I have a lot of potential facets, so I don't want to create an aggregation for each one, as that would be prohibitively expensive. So no, I cannot use any kind of filtering, as that would remove search results. – Robert Wille Jun 13 '18 at 13:07

0 Answers0