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

**URL:** <https://discuss.elastic.co/t/timelion-filtering-within-query-and-choosing-different-indexes-as-a-source/48705>\
**Category:** Kibana\
**Tags:** timelion\
**Created:** [April 28, 2016, 4:14pm UTC](https://discuss.elastic.co/t/timelion-filtering-within-query-and-choosing-different-indexes-as-a-source/48705 "2016-04-28T16:14:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![arthur-y](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arthur-y/32/7896_2.png) [@arthur-y](https://discuss.elastic.co/u/arthur-y)\
**Post date:** [April 28, 2016, 4:14pm UTC](https://discuss.elastic.co/t/timelion-filtering-within-query-and-choosing-different-indexes-as-a-source/48705/1 "2016-04-28T16:14:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bhatch](https://avatars.discourse-cdn.com/v4/letter/b/e95f7d/32.png) [@bhatch](https://discuss.elastic.co/u/bhatch)\
**Post date:** [April 28, 2016, 4:32pm UTC](https://discuss.elastic.co/t/timelion-filtering-within-query-and-choosing-different-indexes-as-a-source/48705/2 "2016-04-28T16:32:08Z")

</div>

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')`

 ![](https://us1.discourse-cdn.com/elastic/original/2X/b/b50e56ef187fefc44542cb611ed813d2d2c5a133.png)

---

<div class="post-metadata">

**Author:** ![arthur-y](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arthur-y/32/7896_2.png) [@arthur-y](https://discuss.elastic.co/u/arthur-y)\
**Post date:** [April 29, 2016, 9:03am UTC](https://discuss.elastic.co/t/timelion-filtering-within-query-and-choosing-different-indexes-as-a-source/48705/3 "2016-04-29T09:03:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![arthur-y](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arthur-y/32/7896_2.png) [@arthur-y](https://discuss.elastic.co/u/arthur-y)\
**Post date:** [April 29, 2016, 10:48am UTC](https://discuss.elastic.co/t/timelion-filtering-within-query-and-choosing-different-indexes-as-a-source/48705/4 "2016-04-29T10:48:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bhatch](https://avatars.discourse-cdn.com/v4/letter/b/e95f7d/32.png) [@bhatch](https://discuss.elastic.co/u/bhatch)\
**Post date:** [May 2, 2016, 9:48pm UTC](https://discuss.elastic.co/t/timelion-filtering-within-query-and-choosing-different-indexes-as-a-source/48705/5 "2016-05-02T21:48:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:54pm UTC](https://discuss.elastic.co/t/timelion-filtering-within-query-and-choosing-different-indexes-as-a-source/48705/6 "2017-07-06T13:54:34Z")

</div>


