elasticsearch subtract numeric fields between two datasets -
some statistical info present, task display timespan latest value , delta (initial value - latest value).
is there way how can done via elasticsearch, not running 2 queries , making subtraction manually?
for instance, have data:
{ downloads: 100, purchases: 100, data: '01/01/2014' }, { downloads: 120, purchases: 120, data: '01/02/2014' } and timespan specified 01/01/2014 - 01/02/2014
query should homecoming info 01/02/2014, 20 delta downloads , 20 delta purchases.
thanks!
you should utilize date histogram aggregations nested stats aggregation , manually calculate difference result.
you explore gist https://gist.github.com/mikeasick/8734117
elasticsearch
No comments:
Post a Comment