# How to Query last 90 minutes records in elasticsearch sql query

**URL:** https://discuss.elastic.co/t/how-to-query-last-90-minutes-records-in-elasticsearch-sql-query/176180
**Category:** Elasticsearch
**Tags:** elastic-stack-sql
**Created:** [April 10, 2019, 9:02am UTC](https://discuss.elastic.co/t/how-to-query-last-90-minutes-records-in-elasticsearch-sql-query/176180 "2019-04-10T09:02:33Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Gnanendra](https://avatars.discourse-cdn.com/v4/letter/g/65b543/32.png) [@Gnanendra](https://discuss.elastic.co/u/Gnanendra)
#### Post date: [April 10, 2019, 9:02am UTC](https://discuss.elastic.co/t/how-to-query-last-90-minutes-records-in-elasticsearch-sql-query/176180/1 "2019-04-10T09:02:33Z")

</div>

Hi,

how to query and get last 90 minutes data using elasticsearch sql query.

now i am running below command please modified this one:

`select index_stats.index, index_stats.primaries.indexing.index_total, index_stats.primaries.docs.count, timestamp from ".monitoring-es-6-2019.04.10" where index_stats.index like 'my_indices-2019.04.08' order by timestamp desc limit 10;`

please help me

Thanks,  
gnanendra

---

<div class="post-metadata">

### Author: ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)
#### Post date: [April 11, 2019, 7:03am UTC](https://discuss.elastic.co/t/how-to-query-last-90-minutes-records-in-elasticsearch-sql-query/176180/2 "2019-04-11T07:03:18Z")

</div>

Hi @Gnanendra,

First of, please, format your query. It's less readable unformatted.  
Also, for the `index_stats.index`comparison I don't think you need a `LIKE` statement, an equal one should do just fine.

`SELECT index_stats.index, index_stats.primaries.indexing.index_total, index_stats.primaries.docs.count, timestamp FROM ".monitoring-es-6-2019.04.10" WHERE index_stats.index='my_indices-2019.04.08' AND timestamp < NOW() AND timestamp > NOW() - INTERVAL 30 MINUTE;`

---

<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 9, 2019, 7:03am UTC](https://discuss.elastic.co/t/how-to-query-last-90-minutes-records-in-elasticsearch-sql-query/176180/3 "2019-05-09T07:03:21Z")

</div>

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