# \#elastic-stack-sql

**URL:** https://discuss.elastic.co/tag/elastic-stack-sql/13.md?page=4

[Latest](https://discuss.elastic.co/latest.md) · [Categories](https://discuss.elastic.co/categories.md) · [Tags](https://discuss.elastic.co/tags.md)

**Page:** 5

---

## [CANVAS SQL: condition with timestamp](https://discuss.elastic.co/t/canvas-sql-condition-with-timestamp/259282)

<div class="topic-metadata">

**Author:** [@TheHunter1](https://discuss.elastic.co/u/TheHunter1)\
**Replies:** 2\
**Last updated:** [December 23, 2020, 8:03am UTC](https://discuss.elastic.co/t/canvas-sql-condition-with-timestamp/259282 "2020-12-23T08:03:19Z")

</div>

Hello, I am creating a canvas where I would like to show some anomalies in my cluster, and I wanna create something that show me if a new user in my AD has been created between midnight and 7am for example. I have this…

---

## [Extract date from timestamp field](https://discuss.elastic.co/t/extract-date-from-timestamp-field/259349)

<div class="topic-metadata">

**Author:** [@anjali28](https://discuss.elastic.co/u/anjali28)\
**Replies:** 1\
**Last updated:** [December 23, 2020, 12:40am UTC](https://discuss.elastic.co/t/extract-date-from-timestamp-field/259349 "2020-12-23T00:40:03Z")

</div>

hello, i have a time field and i want to extract date from it in my elasticsearch sql query. Below is the format of time: 2020-01-11T02:13:00.000Z which function in elasticsearch sql query will extract the date from i…

---

## [Visual C++ Redistributable error](https://discuss.elastic.co/t/visual-c-redistributable-error/259210)

<div class="topic-metadata">

**Author:** [@nameisnotimportant](https://discuss.elastic.co/u/nameisnotimportant)\
**Replies:** 0\
**Last updated:** [December 21, 2020, 2:35am UTC](https://discuss.elastic.co/t/visual-c-redistributable-error/259210 "2020-12-21T02:35:46Z")

</div>

Trying to install the ODBC driver but the esodbc driver keeps asking for Visual C++ 2017 Redistributable, which, i already installed. Any idea wheat is wrong ?

---

## [Elasticsearch SQL ORDER BY Month](https://discuss.elastic.co/t/elasticsearch-sql-order-by-month/256716)

<div class="topic-metadata">

**Author:** [@willemdh](https://discuss.elastic.co/u/willemdh)\
**Replies:** 7\
**Last updated:** [December 18, 2020, 7:57am UTC](https://discuss.elastic.co/t/elasticsearch-sql-order-by-month/256716 "2020-12-18T07:57:10Z")

</div>

Hello, I'm almost there getting my vertical bar to work in Canvas based on a SQL query, but I'm having a hard time ordering the monthly buckets chronologically. My SQL query: SELECT COUNT(DISTINCT user.name) AS UniqueU…

---

## [Time filter is not working](https://discuss.elastic.co/t/time-filter-is-not-working/258000)

<div class="topic-metadata">

**Author:** [@Treki](https://discuss.elastic.co/u/Treki)\
**Replies:** 6\
**Last updated:** [December 16, 2020, 10:58pm UTC](https://discuss.elastic.co/t/time-filter-is-not-working/258000 "2020-12-16T22:58:09Z")

</div>

Hello, this is our Canvas workpad: As you can see time filter on top of the page does not work correctly regarding the elements presented in the data table. This is the expression of the time filter: This is the…

---

## [Null values while indexing using logstash](https://discuss.elastic.co/t/null-values-while-indexing-using-logstash/258677)

<div class="topic-metadata">

**Author:** [@Sammeta\_David\_Raju](https://discuss.elastic.co/u/Sammeta_David_Raju)\
**Replies:** 0\
**Last updated:** [December 15, 2020, 7:05am UTC](https://discuss.elastic.co/t/null-values-while-indexing-using-logstash/258677 "2020-12-15T07:05:12Z")

</div>

what happens if sql statement has record while indexing and later it changes to null value while using the same select query in logstash in a regular intervals

---

## [ROW\_NUMBER in ES SQL](https://discuss.elastic.co/t/row-number-in-es-sql/257923)

<div class="topic-metadata">

**Author:** [@Treki](https://discuss.elastic.co/u/Treki)\
**Replies:** 7\
**Last updated:** [December 8, 2020, 2:17pm UTC](https://discuss.elastic.co/t/row-number-in-es-sql/257923 "2020-12-08T14:17:34Z")

</div>

Hello, does the command ROW\_NUMBER() exist for ES SQL? When not, is there something equivalent to it? Can someone do an example, please? With best regards

---

## [Convert DateTime to integer](https://discuss.elastic.co/t/convert-datetime-to-integer/257924)

<div class="topic-metadata">

**Author:** [@Treki](https://discuss.elastic.co/u/Treki)\
**Replies:** 2\
**Last updated:** [December 8, 2020, 2:15pm UTC](https://discuss.elastic.co/t/convert-datetime-to-integer/257924 "2020-12-08T14:15:05Z")

</div>

Hello, we have strings in the format "2020-11-10T12:43:58" saved in Kibana. When using ES SQL, we want to convert these strings into an integer or float so that the integer/float increases as the DateTime increases as …

---

## [Is there a SIMILAR TO in Elasticsearch SQL?](https://discuss.elastic.co/t/is-there-a-similar-to-in-elasticsearch-sql/256595)

<div class="topic-metadata">

**Author:** [@ElasticLiver](https://discuss.elastic.co/u/ElasticLiver)\
**Replies:** 2\
**Last updated:** [November 30, 2020, 7:10pm UTC](https://discuss.elastic.co/t/is-there-a-similar-to-in-elasticsearch-sql/256595 "2020-11-30T19:10:42Z")

</div>

Hi, I want to match several values in a Elasticsearch SQL query, is there something like "SIMILAR TO" to do this? WHERE items SIMILAR TO 'CPU Porcentual|CPU Utilization'

---

## [How can I set x-opaque-id when I use es-sql？](https://discuss.elastic.co/t/how-can-i-set-x-opaque-id-when-i-use-es-sql/256065)

<div class="topic-metadata">

**Author:** [@ITzhangqiang](https://discuss.elastic.co/u/ITzhangqiang)\
**Replies:** 4\
**Last updated:** [November 26, 2020, 7:38am UTC](https://discuss.elastic.co/t/how-can-i-set-x-opaque-id-when-i-use-es-sql/256065 "2020-11-26T07:38:19Z")

</div>

Hi,all How can I set x-opaque-id when I use es-sql？

---

## [Sql query giving null ouput](https://discuss.elastic.co/t/sql-query-giving-null-ouput/255945)

<div class="topic-metadata">

**Author:** [@rohitarorait82](https://discuss.elastic.co/u/rohitarorait82)\
**Replies:** 5\
**Last updated:** [November 20, 2020, 7:44am UTC](https://discuss.elastic.co/t/sql-query-giving-null-ouput/255945 "2020-11-20T07:44:52Z")

</div>

Hi All, I am stuck with sql query output, can anyone please help POST \_sql?format=txt { "query": "SELECT SERVICE\_NAME,CASE WHEN MSA\_STATUS.keyword ='PUBLISH' AND MSA\_FLOW\_DIR.keyword ='EAI - SCRM specific processing' …

---

## [Query "-" on fieldname problem](https://discuss.elastic.co/t/query-on-fieldname-problem/254255)

<div class="topic-metadata">

**Author:** [@Eurosom](https://discuss.elastic.co/u/Eurosom)\
**Replies:** 1\
**Last updated:** [November 4, 2020, 11:46am UTC](https://discuss.elastic.co/t/query-on-fieldname-problem/254255 "2020-11-04T11:46:15Z")

</div>

Hi Support, We have problem querying file name with "-" for example sts-empId. It is complaining - character. Could you please help how to query this? GET /\_sql?format=txt { "query":" SELECT sts-empId FROM "sts-amsgu…

---

## [\[Solved\] Using /\_xpack/sql endpoint with dates with curl](https://discuss.elastic.co/t/solved-using-xpack-sql-endpoint-with-dates-with-curl/252742)

<div class="topic-metadata">

**Author:** [@Tiago\_Cruz](https://discuss.elastic.co/u/Tiago_Cruz)\
**Replies:** 3\
**Last updated:** [October 22, 2020, 7:53am UTC](https://discuss.elastic.co/t/solved-using-xpack-sql-endpoint-with-dates-with-curl/252742 "2020-10-22T07:53:04Z")

</div>

Hello, This works good: $ curl -X POST "localhost:9200/\_xpack/sql?format=txt&pretty" -H 'Content-Type: application/json' -d' { "query": "SELECT count(\*) FROM whatsapp\_202010 WHERE clientInfo.customerId = 7503" } ' …

---

## [Elasticsearch-sql can't query unindexed field](https://discuss.elastic.co/t/elasticsearch-sql-cant-query-unindexed-field/251635)

<div class="topic-metadata">

**Author:** [@ITzhangqiang](https://discuss.elastic.co/u/ITzhangqiang)\
**Replies:** 26\
**Last updated:** [October 14, 2020, 2:52am UTC](https://discuss.elastic.co/t/elasticsearch-sql-cant-query-unindexed-field/251635 "2020-10-14T02:52:03Z")

</div>

As we know , unindexed field will store in \_source field,so we can get those unindexed fields in \_source.But Elasticsearch-sql can't get unindexed field. GET /\_sql/translate { "query":""" select \* from "view-laohu-s…

---

## [Elasticsearch SQL retrieve more than 1000](https://discuss.elastic.co/t/elasticsearch-sql-retrieve-more-than-1000/250614)

<div class="topic-metadata">

**Author:** [@ananya\_ramesh](https://discuss.elastic.co/u/ananya_ramesh)\
**Replies:** 1\
**Last updated:** [October 2, 2020, 9:38am UTC](https://discuss.elastic.co/t/elasticsearch-sql-retrieve-more-than-1000/250614 "2020-10-02T09:38:02Z")

</div>

Implementing SQL query in Elasticsearch, not able to extract records more than 1000 in spite of LIMIT \> 1000. Tried "index.mapping.total\_fields.limit": 5000 , but did not help. POST \_sql?format=txt { "query": "SELECT…

---

## [CURRENT\_DATE() Wrongggg?](https://discuss.elastic.co/t/current-date-wrongggg/249531)

<div class="topic-metadata">

**Author:** [@Samuel\_Amico](https://discuss.elastic.co/u/Samuel_Amico)\
**Replies:** 3\
**Last updated:** [September 23, 2020, 1:00pm UTC](https://discuss.elastic.co/t/current-date-wrongggg/249531 "2020-09-23T13:00:51Z")

</div>

Guys, there is an erro here in the WHERE clause in canvas: SELECT CURRENT\_DATE(),CAST(start\_time AS DATE) FROM "active\_calls", but when I put the where clause to COUT(\*) SELECT CURRENT\_DATE(),CAST(start\_time AS DA…

---

## [Kibana SQL - How to do where clause for @timestamp?](https://discuss.elastic.co/t/kibana-sql-how-to-do-where-clause-for-timestamp/249651)

<div class="topic-metadata">

**Author:** [@kelk](https://discuss.elastic.co/u/kelk)\
**Replies:** 1\
**Last updated:** [September 23, 2020, 12:11pm UTC](https://discuss.elastic.co/t/kibana-sql-how-to-do-where-clause-for-timestamp/249651 "2020-09-23T12:11:51Z")

</div>

hi I'm able to successfully do the SQL , but if I need to compare to @timestamp it fails as it doesn't like @ symbol POST \_sql?format=txt { "query": """ SELECT \* from mytable WHERE @timestamp \< TODAY - INTERVAL 1 DAY…

---

## [Can ES SQL do things JSON search DSL can't?](https://discuss.elastic.co/t/can-es-sql-do-things-json-search-dsl-cant/248741)

<div class="topic-metadata">

**Author:** [@dvisz-inf](https://discuss.elastic.co/u/dvisz-inf)\
**Replies:** 1\
**Last updated:** [September 15, 2020, 9:52pm UTC](https://discuss.elastic.co/t/can-es-sql-do-things-json-search-dsl-cant/248741 "2020-09-15T21:52:00Z")

</div>

Hi all, I've been working with Elasticsearch a lot for the past two years. Although I come from a relational background, I've avoided using ES' SQL altogether, assuming that it couldn't do anything that the ES JSON sea…

---

## [When using SQL, the IN statement does not work in the SELECT section of a query](https://discuss.elastic.co/t/when-using-sql-the-in-statement-does-not-work-in-the-select-section-of-a-query/247118)

<div class="topic-metadata">

**Author:** [@meadows.120](https://discuss.elastic.co/u/meadows.120)\
**Replies:** 2\
**Last updated:** [September 10, 2020, 2:47pm UTC](https://discuss.elastic.co/t/when-using-sql-the-in-statement-does-not-work-in-the-select-section-of-a-query/247118 "2020-09-10T14:47:09Z")

</div>

ES Version: 7.8 I’m trying to run the following in SQL Workbench, and one query works, but the other one does not…any thoughts? Successful: SELECT \* FROM my\_index WHERE a.b IN ('115') Failure: SELECT a.b IN …

---

## [Retain long data type value in SQL output](https://discuss.elastic.co/t/retain-long-data-type-value-in-sql-output/246997)

<div class="topic-metadata">

**Author:** [@askids](https://discuss.elastic.co/u/askids)\
**Replies:** 1\
**Last updated:** [September 10, 2020, 11:01am UTC](https://discuss.elastic.co/t/retain-long-data-type-value-in-sql-output/246997 "2020-09-10T11:01:28Z")

</div>

hi, I am trying to get min value of an attribute using SQL api. My query looks like this SELECT MIN(attr1) as min\_val from index\_name However, in the output, the value is getting converted to scientific value and is l…

---

## [Intersection of two lists stored as string](https://discuss.elastic.co/t/intersection-of-two-lists-stored-as-string/244064)

<div class="topic-metadata">

**Author:** [@Sultanow](https://discuss.elastic.co/u/Sultanow)\
**Replies:** 0\
**Last updated:** [August 6, 2020, 4:27pm UTC](https://discuss.elastic.co/t/intersection-of-two-lists-stored-as-string/244064 "2020-08-06T16:27:28Z")

</div>

We have an index called "queues" that stores snapshots of queue states as follows: Each document contains (along some other fields) the following fields: timestamp: type=date, and it is searchable, aggregatable it…

---

## [How to use value from elasticsearch index as parameter in ES SQL functions, like DATE\_DIFF()](https://discuss.elastic.co/t/how-to-use-value-from-elasticsearch-index-as-parameter-in-es-sql-functions-like-date-diff/242365)

<div class="topic-metadata">

**Author:** [@burakka](https://discuss.elastic.co/u/burakka)\
**Replies:** 1\
**Last updated:** [July 27, 2020, 7:59am UTC](https://discuss.elastic.co/t/how-to-use-value-from-elasticsearch-index-as-parameter-in-es-sql-functions-like-date-diff/242365 "2020-07-27T07:59:26Z")

</div>

Hello guys! I want to use Elastic SQL with functions in Kibana Canvas. Therefore I tried to use the function DATE\_DIFF(), with values from an existing Elasticsearch index as parameter in the sql function. I looked at t…

---

## [java.sql.SQLException: This version of the JDBC driver is only compatible with Elasticsearch version vUnknown \[Unknown\], attempting to connect to a server version 7.5.1](https://discuss.elastic.co/t/java-sql-sqlexception-this-version-of-the-jdbc-driver-is-only-compatible-with-elasticsearch-version-vunknown-unknown-attempting-to-connect-to-a-server-version-7-5-1/242698)

<div class="topic-metadata">

**Author:** [@liujiehaobang](https://discuss.elastic.co/u/liujiehaobang)\
**Replies:** 2\
**Last updated:** [July 27, 2020, 7:51am UTC](https://discuss.elastic.co/t/java-sql-sqlexception-this-version-of-the-jdbc-driver-is-only-compatible-with-elasticsearch-version-vunknown-unknown-attempting-to-connect-to-a-server-version-7-5-1/242698 "2020-07-27T07:51:55Z")

</div>

java.sql.SQLException: This version of the JDBC driver is only compatible with Elasticsearch version vUnknown \[Unknown\], attempting to connect to a server version 7.5.1

---

## [SELECT IN (SELECT, SELECT)](https://discuss.elastic.co/t/select-in-select-select/240495)

<div class="topic-metadata">

**Author:** [@MatDemb](https://discuss.elastic.co/u/MatDemb)\
**Replies:** 0\
**Last updated:** [July 9, 2020, 8:43am UTC](https://discuss.elastic.co/t/select-in-select-select/240495 "2020-07-09T08:43:09Z")

</div>

Hello, I try to extract some datas with SQL request in canvas but I don't find the way to do it with sql restriction essql has (and my poor experience on it). Here an example of data I have (each row is a document): c…

---

## [Essql timestamp query in canvas](https://discuss.elastic.co/t/essql-timestamp-query-in-canvas/239712)

<div class="topic-metadata">

**Author:** [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Replies:** 2\
**Last updated:** [July 3, 2020, 4:57pm UTC](https://discuss.elastic.co/t/essql-timestamp-query-in-canvas/239712 "2020-07-03T16:57:30Z")

</div>

SELECT islandtype FROM "index1\*" where '@timestamp' \> now() - INTERVAL 200 minutes group by islandtype this give me blank it says no document found. but I know I have document. when I remove where clause it give me o…

---

## [GROUP BY SQL returns no data](https://discuss.elastic.co/t/group-by-sql-returns-no-data/239347)

<div class="topic-metadata">

**Author:** [@dbuzz](https://discuss.elastic.co/u/dbuzz)\
**Replies:** 1\
**Last updated:** [July 2, 2020, 1:38pm UTC](https://discuss.elastic.co/t/group-by-sql-returns-no-data/239347 "2020-07-02T13:38:30Z")

</div>

Hey ALL, I am running simple SQL in the Kibana SQL workspace and getting no data back. Appreciate for any clues! select status, count(\*) as status\_cnt from my-index4 group by status Thanks, Dimon.

---

## [MONTH Interval conversion to use in DATE CLAUSE](https://discuss.elastic.co/t/month-interval-conversion-to-use-in-date-clause/233567)

<div class="topic-metadata">

**Author:** [@vaclav1](https://discuss.elastic.co/u/vaclav1)\
**Replies:** 10\
**Last updated:** [June 23, 2020, 8:13am UTC](https://discuss.elastic.co/t/month-interval-conversion-to-use-in-date-clause/233567 "2020-06-23T08:13:38Z")

</div>

Hello, I have tried to use following SQL in kibana internal index: SELECT dashboard.title FROM ".kibana\*" WHERE updated\_at \> TODAY() - INTERVAL CAST(MONTH\_OF\_YEAR(TODAY()) AS interval\_month) MONTHS Unfortunately I get…

---

## [How can I get all the fields and rows of the most recent write from Elastic with essql?](https://discuss.elastic.co/t/how-can-i-get-all-the-fields-and-rows-of-the-most-recent-write-from-elastic-with-essql/237563)

<div class="topic-metadata">

**Author:** [@jaffarkazi](https://discuss.elastic.co/u/jaffarkazi)\
**Replies:** 2\
**Last updated:** [June 18, 2020, 6:32am UTC](https://discuss.elastic.co/t/how-can-i-get-all-the-fields-and-rows-of-the-most-recent-write-from-elastic-with-essql/237563 "2020-06-18T06:32:50Z")

</div>

I have employee records, (say name, dob, address) and a timewritten field, which is time converted to seconds. This data is written to my index every 5 seconds. Suppose there are 5 records. Run 1 will write employee re…

---

## [Elasticsearch SQL - HAVING query seems to have broken](https://discuss.elastic.co/t/elasticsearch-sql-having-query-seems-to-have-broken/235312)

<div class="topic-metadata">

**Author:** [@flxdan](https://discuss.elastic.co/u/flxdan)\
**Replies:** 1\
**Last updated:** [June 3, 2020, 6:11am UTC](https://discuss.elastic.co/t/elasticsearch-sql-having-query-seems-to-have-broken/235312 "2020-06-03T06:11:12Z")

</div>

For reporting purposes I created a SQL query to report when a winlogbeat agent hasn't sent any data within the last hour: POST \_sql?format=txt { "query": """ select agent.hostname, max("@timestamp") …

---

## [Unable to use Xpack SQL Handle](https://discuss.elastic.co/t/unable-to-use-xpack-sql-handle/235281)

<div class="topic-metadata">

**Author:** [@Basil\_Paul](https://discuss.elastic.co/u/Basil_Paul)\
**Replies:** 4\
**Last updated:** [June 2, 2020, 7:26am UTC](https://discuss.elastic.co/t/unable-to-use-xpack-sql-handle/235281 "2020-06-02T07:26:26Z")

</div>

I had tried installing xpack. But unfortunately Iam not able to use the same. I have attached the output and command. Please help. Command GET /\_cat/plugins?v Output name component version Qreda\_Dev-1 sql 5.3.0.0 Q…

[Previous page](https://discuss.elastic.co/tag/elastic-stack-sql/13.md?match_all_tags=true&page=3&tags%5B%5D=elastic-stack-sql)

[Next page](https://discuss.elastic.co/tag/elastic-stack-sql/13.md?match_all_tags=true&page=5&tags%5B%5D=elastic-stack-sql)
