Is there a way, in Elasticsearch, to compare current values against values in another time period .i.e, finding the current value of status 500 errors against the same value 24 hours ago in order to create a trend based graph in a dashboard?
I'm using this query in a ruby script so I'm trying to find the a value for a metric now and what it was 24 hours ago. I tried it using the Kibana dashboard using the date range "gt" => "-25h", "lt" => "-24h" but this didn't work. The metric I'm trying to find is that of value of a metric over a rolling hour and comparing that to the same metric's value over 24 hours ago.
The short answer is that it isn't possible in Elasticsearch yet, but we're working on it. There is a PR open which adds a "serial differencing" aggregation to the new set of Pipeline aggs in 2.0:
You build a histo or date_histo, then embed the new diff agg inside of the histogram and specify what "lag" you want differenced. So in your case, you'd specify a lag of 24hrs. The aggregation then subtracts the current point from the same point 24 hours ago and gives you back the difference.
Well, the PR hasn't been merged yet, so the functionality is not available. And it is reliant on new framework (called Pipeline aggregations), which won't be added until Elasticsearch 2.0.
But once the feature is merged, it should work something like this
Yeah, if you need this value, the only way to do it currently is inside your own application. E.g. pull down the entire histogram, then perform the difference calculation yourself.
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.