Elasticsearch SQL query syntax

SELECT is a very powerful statement that can be very simple, but there are also many optional parts that allow you to filter and shape the data you want to solve your complex problems. The complete syntax of the SELECT statement is complicated, but it can be described as follows, similar to what is in SQL:

SELECT select_expr [, ...]
[ FROM table_name [[AS] alias]]
[ WHERE search_condition_1 ]
[ GROUP BY expression [, ...] ]
[ HAVING search_condition_2]
[ ORDER BY order_expression [ ASC | DESC ] [, ...] ]
[ LIMIT [ count ] ]

Elasticsearch only accepts one command at a time in the current stage. Also, it does not support subqueries. Therefore, only table_name (index) is accepted in the FROM clause. To access multiple indices, you can use the asterisk (*) index pattern or SQL LIKE in the FROM clause. Although the reserved keywords include LEFT, RIGHT, INNER, OUTER, and JOIN, Elasticsearch SQL does not yet support left, right, inner, and outer join.

Now, let's describe the order of execution in the SELECT statement according to the SQL standard. This sequence determines the output from a clause in one step that is available for the input to a clause in a subsequent step:

  1. FROM clause
  2. WHERE clause
  3. GROUP BY clause
  4. HAVING clause
  5. SELECT clause
  6. DISTINCT/ALL clause
  7. ORDER BY clause
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.13.180