Retrospectively populate a bucket

I am using elastic to do some aggregations on our data, then creating visual charts from that data. What I would like to be able to do is load the underlying data when a user clicks on the series, or point on the chart. Each series, or point, relates to a bucket or nested bucket of data within the original query.

Is there a generic way I could call the Elastic API to load the data?


This is something, that has to be done is part of the application. If you have a terms aggregation, and you want to filter by everything of the category foo, you have to add a term filter to do so. If you have a range aggregation on a price, you need a range filter in the query. It's not possible to find this out automatically.


I'm probably not explaining the problem very well...

I have the query and aggregation working very well.I set the size to 0 so it returns no actual documents, just the bucket counts/averages etc of the aggregations.

I use these buckets to draw a pie chart. When I click on a slice of the pie chart, I would like to get the underlying documents. I don't want to run the whole query again, just the part necessary to populate that slice (bucket). This is because the original query contains many nested aggregations with filters etc, and populating every bucket would be pointless.

I think i'm looking for something that does not exist, and I will simply have to write each query by hand.

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