Timelion graph - average with a condition

Hi,
i am trying to create a graph in timelion that shows the average value of a field as long as the field is greater than 0.
For some reason i cannot do that.
writing the following command returns all points on the 0 graph scale: See TLQuery1.JPG
.es(index=eu-multitenant-01*,q='d.Elapsed > 0',metric=avg:d.Elapsed)

when i change it to the following: .es(index=eu-multitenant-01*,metric=avg:d.Elapsed) it works fine but the values take into consideration also the 0 amounts which is not what i need. See TLQuery2.JPG

also writing the following command works: .es(index=eu-multitenant-01*,q='d.Elapsed > 0') - but again this return the count of rows where Elapsed is greater than 0 - not what i need. See TLQuery3.JPG



The q parameter of the es function takes a lucene query. AFAIK there is no > operator in lucene (https://lucene.apache.org/core/2_9_4/queryparsersyntax.html), your query is probably searching for the 0 values in your data (which naturally returns a very low average).

Try the - operator instead to exclude things: -d.Elapsed:0

Thank for you very much - it works.

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