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


in the term aggregation it is possible to use the "include" to filter values with a regex.

	"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.