I have a kibana timelion query to plot the actual performance metrics as follows:
.es(index=my_index,timefield=@timestamp,metric=avg:Actual).lines(show=True).points(show=True).label(Performance)
For this I want to add an aggregate line of its average values For which the query is as follows :
.es(index=my_index,timefield=@timestamp,metric=avg:Actual).aggregate(avg)
The problem is aggregate is performed on the whole time range selected which includes past or future time frames where the data is not present. Thus the average falls drastically below the actual average. How to write the aggregate query to ensure it does not consider the NULL or absence of values in the selected time range and give avg of only the numerically available data points which would be more close to original average.