Trying to use the example I'm trying to count the values for 'count_value' field then multiple the result by busy. For some odd reason I can use +, - but * just returns the busy value.
I'm trying to run the below.
double busy = _value; double total = 0; for (int i = 0; i < doc['count_value'].length; ++i) { total += doc['count_value'][i]; } return busy * total;
count_value is a value of 1 for every hour. I use this to "sum" the hours in a day or multiple days selected from the time range. example a range of "yesterday" = 24.
This works well, the result is 24 for "yesterday" for each hour in the day. But the above doc['count_value'].value is not the total for the range but rather the value for the hour = 1.
Is it possible with an inline script to get the total of doc['count_value'].value of the entire range to be used in each bucket calculation? Or a way to pass the "bucket count" back to the script?
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.