# Timelion-style queries

**URL:** <https://discuss.elastic.co/t/timelion-style-queries/46399>\
**Category:** Elasticsearch\
**Created:** [April 5, 2016, 1:44pm UTC](https://discuss.elastic.co/t/timelion-style-queries/46399 "2016-04-05T13:44:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomr/32/48260_2.png) [@tomr](https://discuss.elastic.co/u/tomr)\
**Post date:** [April 5, 2016, 1:44pm UTC](https://discuss.elastic.co/t/timelion-style-queries/46399/1 "2016-04-05T13:44:37Z")

</div>

I want to calculate the ratio of two counts, per minute, over a longer period. I can do this in timelion easily

```
'.es("myquery").divide(.es())'

```

But I'm stuck on how I can generate a query to display this data.

I can get a data histogram for \*, and a date histogram for "myquery", but I'm stuck on getting ES to do the arithmetic for me. Is this even possible?

The use case: I monitor this ratio (2\* or 3\* response codes as a portion of total hits, in web logs) in realtime by pulling a single value for each filter for the timestamp lte now and gte now-1m and dividing one by t'other. I now want to pull historical data.

I have a weird feeling that significant terms agg with the percentage heuristic could do this under certain bizarre conditions: after all, it's not so different to comparing a filtered value against a background count, within a date histogram agg. But maybe I'm way off.

tia,  
Tom

---

<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 5, 2016, 4:30pm UTC](https://discuss.elastic.co/t/timelion-style-queries/46399/2 "2016-04-05T16:30:19Z")

</div>

I would love to have a way to do this in Kibana or Elastic itself also. For now we are just going to use Timelion for it.

---

<div class="post-metadata">

**Author:** ![tomr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomr/32/48260_2.png) [@tomr](https://discuss.elastic.co/u/tomr)\
**Post date:** [April 5, 2016, 4:41pm UTC](https://discuss.elastic.co/t/timelion-style-queries/46399/3 "2016-04-05T16:41:15Z")

</div>

Even a way to view Table / Response data would be a good start for me, like in the rest of Kibana. Viewing the graphs doesn't help.

---

<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 5, 2016, 5:32pm UTC](https://discuss.elastic.co/t/timelion-style-queries/46399/4 "2016-04-05T17:32:19Z")

</div>

It's kind of a pain, but I have occasionally just exported the data from Kibana into excel and ran my own functions on it.

---

<div class="post-metadata">

**Author:** ![tomr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomr/32/48260_2.png) [@tomr](https://discuss.elastic.co/u/tomr)\
**Post date:** [April 5, 2016, 5:53pm UTC](https://discuss.elastic.co/t/timelion-style-queries/46399/5 "2016-04-05T17:53:18Z")

</div>

How do you export the data from a timelion viz?

---

<div class="post-metadata">

**Author:** ![alainc](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@alainc](https://discuss.elastic.co/u/alainc)\
**Post date:** [April 7, 2016, 6:02am UTC](https://discuss.elastic.co/t/timelion-style-queries/46399/6 "2016-04-07T06:02:49Z")

</div>

in latest Kibana 4.5 you can integrate timelion inside your kibana dashboard with certain limits on how the filtering is done.  
filter you apply to the dashboard don't apply only time filrering for the moment.

> [@Timelion timeseries in kibana visualise](https://discuss.elastic.co/t/timelion-timeseries-in-kibana-visualise/45971):
>
> Hi just discovered the timeseries visualise option inside kibana 4.5 great thing but... it seems that the timeseries only compute base on his internal timelion syntax/filtering and so only change value if i adjust the timeframe and not does not change if i filtered by using the filtering box. i explain as i see what i wrote not clear. i create a .cumulative() timeserie like this .cusum(.es(\*)) and i see reality of the cumulative value. if i want to filter in the dashboard with smith\* all my…

---

<div class="post-metadata">

**Author:** ![tomr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomr/32/48260_2.png) [@tomr](https://discuss.elastic.co/u/tomr)\
**Post date:** [April 7, 2016, 6:05am UTC](https://discuss.elastic.co/t/timelion-style-queries/46399/7 "2016-04-07T06:05:13Z")

</div>

Yes, I can view the data in Kibana (even without switching to the Timelion plugin). But I don't want a picture, I want the data and/or a way to get it.

In the core visualisations you can see the Request and Response... but not in a 'Timeseries' (ie Timelion) viz

---

<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 5, 2017, 11:01pm UTC](https://discuss.elastic.co/t/timelion-style-queries/46399/8 "2017-07-05T23:01:38Z")

</div>


