Above average


We have simple keywords in our docs with dates.
We would like to get all terms that were in a range of dates (14 days) that are above their monthly average of occurrences.

Is that possible?

I think you need to fire 2 queries for that.

The first will compute the average.
The second will search for documents above.

What do you mean? If I have 1m docs, that I want to pull the highest above average in the last 14 days? how can I pipe this into 2 queries?

May be I did not get exactly the use case.

I'd filter the last month of data and compute an average aggregation.

Read that value from the response.

Then run a date range filter to select the last 14 days and apply as well a range filter where the value is above the value we got with the previous query.

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