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?
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)
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.