# Convert MySQL query to elasticsearch

**URL:** <https://discuss.elastic.co/t/convert-mysql-query-to-elasticsearch/40830>\
**Category:** Kibana\
**Created:** [February 3, 2016, 7:32am UTC](https://discuss.elastic.co/t/convert-mysql-query-to-elasticsearch/40830 "2016-02-03T07:32:57Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![tbragin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tbragin/32/45166_2.png) [@tbragin](https://discuss.elastic.co/u/tbragin)\
**Post date:** [February 8, 2016, 8:58pm UTC](https://discuss.elastic.co/t/convert-mysql-query-to-elasticsearch/40830/7 "2016-02-08T20:58:38Z")

</div>

I think I understand the reason for your question now - you are not indexing "idle time" and "talk time" directly in ES. You should be able to calculate the "idle time" and "talk time" as [scripted fields in Kibana](https://www.elastic.co/guide/en/kibana/current/managing-fields.html#create-scripted-field), assuming you can do that based on data from a single document. If your calculation needs to go across document, you might need to use a script as an input to Date Histogram (see example [here](https://discuss.elastic.co/t/display-concurrency-in-data-on-kibana/26006)). Hope this helps!

---

_[View the full topic](https://discuss.elastic.co/t/convert-mysql-query-to-elasticsearch/40830)._
