Is there a way to loop through all documents with scripted fields?
I want to divide two sums for a given day, and since dividing two aggregated values is impossible, I was thinking if there is a workaround with scripted fileds.
I am thinking of doing something like this:
for (int i=0;i< ALL DOCUMENTS ;++i)
I do not think that is possible as scripted fields run in the context of a single document.
Ok! Thank you for your answer!
Thank you for your answer. I forgot to mention that I want the ratio to be visualised in kibana . Therefore, how could I use the
average aggregation and
scripted metric to show the ratio in kibana? Should I create a new index?
In Kibana the average will be calculated for the time range you'll choose.
If you want to get the average on all the documents regardless the time picker, you will have to create an index pattern without time field.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.