Timelion split and divide not working well


(Vincent Valdy) #1

let's consider the following data
POST /sales/forecast/ {"product":"banana","state":"unsure","price":10, "@timestamp": "2018-06-20T10:00:00.000Z" }
POST /sales/forecast/ {"product":"banana","state":"confirmed","price":20, "@timestamp": "2018-06-20T11:00:00.000Z" }
POST /sales/forecast/ {"product":"banana","state":"confirmed","price":40, "@timestamp": "2018-06-21T10:00:00.000Z" }
POST /sales/forecast/ {"product":"banana","state":"confirmed","price":30, "@timestamp": "2018-06-21T11:00:00.000Z" }

POST /sales/forecast/ {"product":"orange","state":"confirmed","price":1, "@timestamp": "2018-06-20T12:00:00.000Z" }
POST /sales/forecast/ {"product":"orange","state":"unsure","price":2, "@timestamp": "2018-06-20T13:00:00.000Z" }
POST /sales/forecast/ {"product":"orange","state":"confirmed","price":4, "@timestamp": "2018-06-21T12:00:00.000Z" }
POST /sales/forecast/ {"product":"orange","state":"confirmed","price":3, "@timestamp": "2018-06-21T13:00:00.000Z" }

POST /sales/forecast/ {"product":"lemon","state":"unsure","price":3, "@timestamp": "2018-06-20T14:00:00.000Z" }
POST /sales/forecast/ {"product":"lemon","state":"unsure","price":5, "@timestamp": "2018-06-20T15:00:00.000Z" }
POST /sales/forecast/ {"product":"lemon","state":"unsure","price":7, "@timestamp": "2018-06-21T14:00:00.000Z" }
POST /sales/forecast/ {"product":"lemon","state":"unsure","price":8, "@timestamp": "2018-06-21T15:00:00.000Z" }

using timelion I want to know the precentage of banana I am sure to sell:
.es(q="+state=confirmed +product=banana",index=sales*,metric=sum:price).divide(.es(q="product=banana",index=sales*,metric=sum:price)),
same goes for lemon and orange
let say I want to use "split" to get these graph:
.es(q="+state=confirmed",index=sales*,metric=sum:price,split=product.keyword:3).divide(.es(q="*",index=sales*,metric=sum:price, split=product.keyword:3)),
this timelion code answer : Unable to pairwise reduce seriesLists, number of series are not the same
if I change the split factor 3 to 2 for example I get : Matching series could not be found for "orange" in ["banana","lemon"].

  1. is this a bug (or lack of functionality)
  2. if yes, could it be fixed (or is it by design)
  3. is there a workaround that would work if a new products arrive without me changing my dashboard each time a new products arrives

(Nathan Reese) #2

Does split return the same keys for each query? Run each es statement separately and see what split is returning. If the terms are not the same, then there is no way to divide the series because timelion does not know how to pair up the split results.


(Vincent Valdy) #3

the problem is that the split does not return the same terms depending of the timerange.......
with this data the returned keys are never the same but adding this data:
POST /sales/forecast/ {"product":"lemon","state":"confirmed","price":8, "@timestamp": "2018-06-21T15:00:00.000Z" }

will make both parts of the divide return the same lists (depending of the timerange)


(system) #4

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