Questions tagged [elasticsearch-sql]

Elasticsearch-SQL is a SQL-like syntax for Elasticsearch introduced in version 6.3 of the Elastic Stack via the x-pack plugin.

Elasticsearch-SQL was introduced in x-pack 6.3. It provides a SQL-like syntax for developers familiar with SQL concepts and is ultimately translated to a Elasticsearch DSL query. The syntax is targeted at new users and data consumers who do not want the complexity or need the features of the full DSL.

Resources

Elasticsearch Demo Site

An Introduction to Elasticsearch SQL with Practical Examples - Part 1

An Introduction to Elasticsearch SQL with Practical Examples - Part 2

Example Query

POST /_xpack/sql?format=txt
{
  "query": "SELECT FlightNum FROM flights LIMIT 10"
}

Translates to this traditional DSL query:

{
  "size": 10,
  "_source": {
    "includes": [
      "FlightNum"
    ],
    "excludes": []
  },
  "sort": [
    {
      "_doc": {
        "order": "asc"
      }
    }
  ]
}

And returns the following response:

FlightNum   
---------------
X98CCZO        
9HY9SWR        
XEJ78I2        
P0WMFH7        
UFK2WIZ        
EAYQW69        
1IRBW25        
JQ2XXQ5        
7TTZM4I        
EVARI8I        
21 questions
0
votes
1 answer

Elasticsearch 7 SQL CLI : ./x-pack-env: No such file or directory error

I have started working on Elasticsearch 7 and trying to start the elasticsearch-sql-cli using the following command: ~/Documents/backups/es7/bin$ ./elasticsearch-sql-cli But it is not started and getting the following…
KayV
  • 12,987
  • 11
  • 98
  • 148
0
votes
1 answer

Parsing error to translate /_sql/translate use UPDATE

I'm using the SQL translator on ElasticSearch on a query that had UPDATE keyword. I can translate SELECT queries, but UPDATE is not working. POST /_sql/translate { "query": "UPDATE inspections SET business_state='RS' WHERE business_city='Passo…
Augusto
  • 3,825
  • 9
  • 45
  • 93
0
votes
4 answers

SQL like GROUP BY AND HAVING example

I am new to ES and i would need to make a query Select value from table group by value having count(distinct(id)) > 1 I do not even have areas to start. referencing this SQL like GROUP BY AND HAVING didnt help much. Example of…
aceminer
  • 4,089
  • 9
  • 56
  • 104
0
votes
2 answers

sql query translation Query DSL kibana

Please explain the logic of the query translation from sql in kibana console. The most confusing is "order" : "asc", while i request desc. The numbers "10985", and "11030" also looks very strange. If I re-run translation these numbers are changing.…
cat_on_the_mat
  • 100
  • 1
  • 9
0
votes
1 answer

Unable to perform SQL search on logstash index in kibana

I have below indexes in the kibana when searched with below query. GET /_xpack/sql?format=txt { "query": "SHOW tables" } Output: name | type ---------------------------------+--------------- .kibana …
0
votes
1 answer

SQL in query with elastic search sql

I'm trying out elastic search sql. It works fine equal operator in where clause. But I couldn't use in operator in where clause. is there any equivalent command here. (like Terms filter) POST _xpack/sql { "query":"Select * from index_name where…
Manikandan
  • 3,025
  • 2
  • 19
  • 28
1
2