Using script instead of a regex in aggs term filter include configuration

Hello,

in the term aggregation it is possible to use the "include" to filter values with a regex.
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#_filtering_values_4

{
	"from": 0,
	"size": 10,
	"query": {
		"match_all": {}
	},
	"aggs": {
		"title": {
			"terms": {
				"field": "title",
				"include": "t.*"
			}
		}
	}
  }

Is there a possibility to filter the values by a script instead of a regex?

If you really need script, you could use script query to filter docs, then use terms aggregation to aggregate on filtered docs.

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