# Timelion - is there a less redundant way?

**URL:** <https://discuss.elastic.co/t/timelion-is-there-a-less-redundant-way/214677>\
**Category:** Kibana\
**Tags:** timelion\
**Created:** [January 10, 2020, 10:07pm UTC](https://discuss.elastic.co/t/timelion-is-there-a-less-redundant-way/214677 "2020-01-10T22:07:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skeeve](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@Skeeve](https://discuss.elastic.co/u/Skeeve)\
**Post date:** [January 10, 2020, 10:07pm UTC](https://discuss.elastic.co/t/timelion-is-there-a-less-redundant-way/214677/1 "2020-01-10T22:07:25Z")

</div>

I'm experimenting with timelion and I'm wondering whether there is a way to express this less redundant:

```
.es(
  split=tenant_name.keyword:10,
  timefield=date,
  metric=sum:spam_complaints
)
.divide(
  .es(
    split=tenant_name.keyword:10,
    timefield=date,
    metric=sum:total_volume
  )
)
.multiply(100)

```

Is there a way to define the split and the timefield at one location?

BTW: Why do I have to explicitly give the timefield? If I don't I get no data or even an error message

```
Error in visualization
[timelion_vis] > Timelion request error: Error: in cell #1: Cannot read property 'data' of undefined Error: in cell #1: Cannot read property 'data' of undefined

```

BTW #2: Why are linebreaks (for readability) not possible in the expression field?

---

<div class="post-metadata">

**Author:** ![markov00](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/markov00/32/33316_2.png) [@markov00](https://discuss.elastic.co/u/markov00)\
**Post date:** [February 7, 2020, 9:55am UTC](https://discuss.elastic.co/t/timelion-is-there-a-less-redundant-way/214677/2 "2020-02-07T09:55:30Z")

</div>

Hi @Skeeve  
unfortunately you can't define the split and timefield somewhere else, but it will be a good enhancement (if you want you can open an enhancement request here: [https://github.com/elastic/kibana/issues/new?template=Feature\_request.md](https://github.com/elastic/kibana/issues/new?template=Feature_request.md))  
The timefield is required because timelion doesn't know what field to use to compute the date histogram aggregation, or better it knows it but if you have multiple date fields it doesn't know what to choose (but I'm also pretty sure that timelion doesn't automatically select a timefield if you only have one timefield on your index).  
About the linebreaks, I think you can add line breaks within each expression function, also also between functions (in this case seems that the line break can be done only using space, that will break to a new line the function

---

<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:** [March 6, 2020, 9:55am UTC](https://discuss.elastic.co/t/timelion-is-there-a-less-redundant-way/214677/3 "2020-03-06T09:55:34Z")

</div>

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