I'm wondering if it is possible to do a same level script aggregation in ES. Let's say I have 2 fields in my documents sales and spend. This is the result I want to achieve:
I know that I can easily do this using per say a date_histogram and use the bucket_script aggregation, so I'm trying to do same here only with the same level aggregation, so I don't have to nest them.
I'm a little unsure about the question. As you know about the bucket_script agg, why didnt it work in your case? Maybe a fully reproducible example would help in this case.
This first histogram is used to represent data and can be done with year, day and month values. The average that needs to be calculated must always be done with a day interval. What I want to achieve is to replace the average_roas with a calculation average_sales/average_spend .
To further elaborate on the average_histogram. I have multiple documents for each day and the sales for one day is the sum of all the documents for that individual day. That's why I want to sum them daily and then get the daily average sales. I do the same for spend as well.
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.