# Canvas Timelion datasource not returning results (using custom timeField)

**URL:** <https://discuss.elastic.co/t/canvas-timelion-datasource-not-returning-results-using-custom-timefield/123160>\
**Category:** Kibana\
**Tags:** timelion\
**Created:** [March 8, 2018, 11:19pm UTC](https://discuss.elastic.co/t/canvas-timelion-datasource-not-returning-results-using-custom-timefield/123160 "2018-03-08T23:19:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jim\_Boutcher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jim_boutcher/32/56725_2.png) [@Jim\_Boutcher](https://discuss.elastic.co/u/Jim_Boutcher)\
**Post date:** [March 8, 2018, 11:19pm UTC](https://discuss.elastic.co/t/canvas-timelion-datasource-not-returning-results-using-custom-timefield/123160/1 "2018-03-08T23:19:08Z")

</div>

Running ES 6.2, installed latest Canvas, and I'm unable to get the timelion datasources working correctly. All data returned is 0.

I loaded a few million documents into an index, timeseries data, for Feb 2018. I'm easily able to use this data directly in timelion with a simple query such as `.es(index=callrecord*,timefield=startDate)` with the time selector set to last 60 days. I get a nice line graph showing the count of my records.

In Canvas, I placed a time selector, set it to last 90 days, and then dropped in a data table. Modified the code to this, using the exact same timelion query:

`filters | timelion query=".es(index=callrecord*,timefield=startDate)" | table perPage=1000 | render`

What I end up with is a 3 column table @timestamp, value #, and label:

2018-02-15T00:00:00-0800 0 q:\* \> count  
2018-02-15T12:00:00-0800 0 q:\* \> count  
...

All the values are 0, when I'm quite sure they're not.

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [March 9, 2018, 6:39pm UTC](https://discuss.elastic.co/t/canvas-timelion-datasource-not-returning-results-using-custom-timefield/123160/2 "2018-03-09T18:39:04Z")

</div>

It's possible that the `timelion` function isn't using the filters context correctly. If you remove the `filters` part from the expression (as below), do you get data in the table?

`timelion query=".es(index=callrecord*,timefield=startDate)" | table perPage=1000 | render`

---

<div class="post-metadata">

**Author:** ![Jim\_Boutcher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jim_boutcher/32/56725_2.png) [@Jim\_Boutcher](https://discuss.elastic.co/u/Jim_Boutcher)\
**Post date:** [March 9, 2018, 7:00pm UTC](https://discuss.elastic.co/t/canvas-timelion-datasource-not-returning-results-using-custom-timefield/123160/3 "2018-03-09T19:00:10Z")

</div>

That's the issue! I removed the `filters` from the front, and now I have data being returned.

What's odd is that the filters seemed to be applied (it filtered the correct date ranges) - just all the values were zero.

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [March 9, 2018, 8:33pm UTC](https://discuss.elastic.co/t/canvas-timelion-datasource-not-returning-results-using-custom-timefield/123160/4 "2018-03-09T20:33:04Z")

</div>

Oh, actually, maybe it's not a bug after all.

Can you check the expression on the time picker element and make sure it's using the correct field? By default, you'll see this:

`timefilterControl compact=true column=@timestamp`

But in your case, the time column is `startDate`, not `@timestamp`.

I suspect setting it to `timefilterControl compact=true column=startDate` will make it function correctly.

---

<div class="post-metadata">

**Author:** ![Jim\_Boutcher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jim_boutcher/32/56725_2.png) [@Jim\_Boutcher](https://discuss.elastic.co/u/Jim_Boutcher)\
**Post date:** [March 9, 2018, 9:19pm UTC](https://discuss.elastic.co/t/canvas-timelion-datasource-not-returning-results-using-custom-timefield/123160/5 "2018-03-09T21:19:04Z")

</div>

Makes sense. I set the timeFilter's column property to `startDate`, confirmed the code reflected what you suggested, but it didn't change the data table's results. The data table still shows @timestamp as the first column of the results.

Debug render output of the filters | timelion output looks like this:

{  
"@timestamp": 1512896400000,  
"value": 0,  
"label": "q:\* \> count"  
},  
{  
"@timestamp": 1512939600000,  
"value": 0,  
"label": "q:\* \> count"  
},  
{  
"@timestamp": 1512982800000,  
"value": 0,  
"label": "q:\* \> count"  
},  
{  
"@timestamp": 1513026000000,  
"value": 0,  
"label": "q:\* \> count"  
},  
{  
"@timestamp": 1513069200000,  
"value": 0,  
"label": "q:\* \> count"  
},

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [March 9, 2018, 9:49pm UTC](https://discuss.elastic.co/t/canvas-timelion-datasource-not-returning-results-using-custom-timefield/123160/6 "2018-03-09T21:49:48Z")

</div>

Thanks, that's helpful. It's probably a bug then. Or maybe I'm just using the time picker wrong myself 😉

I'll open an issue and we'll look into it.

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [March 28, 2018, 6:07pm UTC](https://discuss.elastic.co/t/canvas-timelion-datasource-not-returning-results-using-custom-timefield/123160/7 "2018-03-28T18:07:42Z")

</div>

@Jim_Boutcher are you still running into this issue with the newest Canvas release? We tried to replicate it locally and everything seems to be working the way it should.

---

<div class="post-metadata">

**Author:** ![Jim\_Boutcher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jim_boutcher/32/56725_2.png) [@Jim\_Boutcher](https://discuss.elastic.co/u/Jim_Boutcher)\
**Post date:** [April 4, 2018, 3:59am UTC](https://discuss.elastic.co/t/canvas-timelion-datasource-not-returning-results-using-custom-timefield/123160/8 "2018-04-04T03:59:11Z")

</div>

@Joe_Fleming - works perfectly now! Thank you!

---

<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:** [May 2, 2018, 3:59am UTC](https://discuss.elastic.co/t/canvas-timelion-datasource-not-returning-results-using-custom-timefield/123160/9 "2018-05-02T03:59:27Z")

</div>

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