Kibana group by taskname and count average days between dates


I have an index containing taskname, startdate and enddate. I wan't to group by taskname, that's no problem, but now i wan't to calculate the interval between start and enddate and show the average per group. Any suggestions?

Thanks in advance.


Hi, you can do this by adding a scripted field. The script should take start and enddate and calculate the duration of the document. Then you can use a regular average aggregation on the newly created field.

If this applies to your use case you can also calculate the duration prior to ingesting the document and put it in the document to begin with (this allows more efficient querying which can become relevant if you have lots of data)

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