# Canvas: Error empty database from essql query

**URL:** <https://discuss.elastic.co/t/canvas-error-empty-database-from-essql-query/230316>\
**Category:** Kibana\
**Tags:** canvas\
**Created:** [April 29, 2020, 6:44am UTC](https://discuss.elastic.co/t/canvas-error-empty-database-from-essql-query/230316 "2020-04-29T06:44:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![esther.k](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/esther.k/32/67343_2.png) [@esther.k](https://discuss.elastic.co/u/esther.k)\
**Post date:** [April 29, 2020, 6:44am UTC](https://discuss.elastic.co/t/canvas-error-empty-database-from-essql-query/230316/1 "2020-04-29T06:44:24Z")

</div>

Hi,  
I saw something weird in my Canvas.

There is a markdown element represents alert count.  
I wrote Elasticsearch sql to query alert count like this:

```auto
filters
| essql 
  query="SELECT \"@timestamp\", prometheus.query.alert_warning_count as warn FROM \"metricbeat-*\" WHERE prometheus.query.alert_warning_count IS NOT NULL AND \"@timestamp\" >= NOW()-INTERVAL 5 MINUTES ORDER BY \"@timestamp\" DESC LIMIT 1"
| math "warn"
| markdown "{{warn}}" | render

```

This query gave an "Empty Database" error to me in Canvas.  
However, it works well when I tried with same query in Kibana Dev Tool Console.  
(FYI, I used "GET \_sql?format=txt" API)

Please advice me. 🙏

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [May 4, 2020, 8:54pm UTC](https://discuss.elastic.co/t/canvas-error-empty-database-from-essql-query/230316/2 "2020-05-04T20:54:02Z")

</div>

Hello,  
Here are some examples that you can use as format for the essql queries: [https://github.com/alexfrancoeur/kibana\_canvas\_examples/tree/master/presentations/apm\_metrics\_logs](https://github.com/alexfrancoeur/kibana_canvas_examples/tree/master/presentations/apm_metrics_logs)  
I'm not that knowledgeable in SQL, but these should be able to help.

---

<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:** [June 1, 2020, 8:54pm UTC](https://discuss.elastic.co/t/canvas-error-empty-database-from-essql-query/230316/3 "2020-06-01T20:54:04Z")

</div>

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