I have a set of data from an elastic search index for a period of 1 hour today.
I want to compare that count with the data for the same 1 hrs but 7days ago.
And then calculate the percentage change.
Please suggest ways!
there are a couple of solutions to this. I am not sure what you mean with
count here. Is it just the number of documents or something else? You could execute a single query that searches for both time spans (and your other criteria) and then use a filters aggregation for each timespan - you could even go one step further and do the final calculation using a pipeline aggregation. You could also just execute two queries and calculate the difference on the client side.
Do whatever is the easiest for you and gives you the right answer.
Hello @spinscale , Thanks for the quick reply.
Yes, the count I mentioned is just the number of documents.
Now the challenge I am facing while using filter aggregation is that I am unable to add filter for "the current 1 hour data 7 days ago " .
Tried "now -7d" .It just gives me the data for 7 days.
Can you please help me out with the filter query?
sorry, not sure I get what the problem is? If you were able to specify the same in query you can also specify it in a filter.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.