Combine multiple terms aggregation as a pipeline

Lets say I have two fields in my docs location and projects. I want a terms aggregation on locations first and then on each of the aggregated buckets run a terms aggregation on projects. Is this possible? I went through the docs but was unable to find a pipeline aggregation using terms

Hey,

can you explain why you need a pipeline agg for this? This sounds like having a terms on the location first and then a inner aggregation on the projects so that you get aggregations per project-per location sounds like this already solved the problem.

What am I missing?

--Alex

Yes thats right, I shouldn't have used the term pipeline I guess sounds confusing but I thought since it project based aggreagtion will work on the output of location based agg so I thought I might need to use a pipeline for it.

@spinscale are successive terms aggregation possible?

Yes, take another closer look at the structure at https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html#_structuring_aggregations

There is also an example using the max aggregation in the terms agg docs, see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html

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