Timelion -- filtering within query and choosing different indexes as a source


(Arthur Y) #1

Hello!
We are testing right now Timelion, and despite its syntax is a bit complicated to get to used to at a first glance, we do love this plugin!

My question is if it's possible to build a graph by referring to different indexes in Elastic and cross the data?

e.g.
.es(index=bi*,'website:xyz.com.',metric='sum:revenue'), .es(index=traffic*,'context.page.path:/xyz.com/order')

Another question is if it's possible to apply a filter within the query. For instance, I want to search in specific index, where document contains a text string that I set in the query

Example
.es(index=bi-experiment*,'affiliateData.website:xyz.com',metric='sum:commission')

I got an error

Timelion: Error: in cell #1: [illegal_argument_exception] Expected numeric type on field [date], but got [string]

I would appreciate very much your answer


(Brandon Hatch) #2

1st questions. What do you mean by cross the data? Like take data from one index and divide it by data from a different index? That should be possible.

2nd question: Add "q=" to your query.

.es(index=bi-experiment*,q='affiliateData.website:xyz.com',metric='sum:commission')


(Arthur Y) #3

Thanks for reply, Brandon.

  1. Yes, correct. Make operations referring to different indexes
  2. provided example did not work, complains about :
    [illegal_argument_exception] Expected numeric type on field [date], but got [string]
    I think it complains about the first part of expression and is unable to understand that I want to select specific index.
    .es(index=bi-experiment*,q='affiliateData.website:xyz.com',metric='sum:commission')

Pardon me, if am a noob, but I feel the documentation on Timelion lacks examples


(Arthur Y) #4

I guess I found an answer for my issue

  1. Selected index should contain the same date field as the index you are comparing to in timelion.json file:
    },
    "es": {
    "timefield": "date",
    "default_index": "bi-experiment",
    "allow_url_parameter": false
    },

Otherwise it will throw an exception as mentioned above:
[illegal_argument_exception] Expected numeric type on field [date], but got [string]

  1. Once I fixed that for testing in timelion.json I had a mismatch for one of the fields, as it was wrongly set as string, not double. So the expresion
    .es(index=bi-experiment*,q='affiliateData.website:xyz.com',metric='sum:commission')
    throwed Expected numeric type on field [commission], but got [string]

Conclusion:
Wrong mapping prevented me from getting data from different indexes


(Brandon Hatch) #5

All of our indexes use the same date field so we never came across that error. Glad to hear you figured it out.


(system) #6