Possible to aggregate and filter on the same key?


#1

I'm not very experienced with Elastic but is it possible to aggregate and filter on the same key?

Say I want the departments of a certain city that is being filtered on. This may be a dumb question but is there anyway to do this or is my query incorrect? I know it is invalid JSON due to the same key (department.id). Would the pipeline aggregation be something viable to use?

The top query would be a "match_all" query.

Aggregations such as:

"aggregations": {
	"department.id": {
		"terms": {
			"field": "department.id",
			"size": 10
		}
	},
	"department.id": {
		"filter": {
			"bool": {
				"filter": {
					"terms": {
						"city": ["chicago"]
					}
				}
			}
		}
	}
}

(system) #2

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