Possible to store aggregation results in a new index


#1

Hi,
I want to store results of an elasticsearch aggregation in a new index, In other words I want all of documents that match aggregation are stored in a new index.
please help me.


(Zachary Tong) #2

There is no built in mechanism for this, but you can certainly write a script to index the result of an aggregation. Have your application execute the aggregation, then extract the portions of the response you are interested and write them back into the cluster under a new index.

I've seen this done sometimes to pre-compute "summaries" of data for easy access later.


#3

Thanks Zachary,
how to write a script to index the result of an aggregation? Please explain with an example.


(system) #4