Basic Queries And Conditions - eliranmoyal/elasticsearch-sql GitHub Wiki

##Query The basic query syntax is:
SELECT fields from indexName WHERE conditions

To query a specific type of an index use:
SELECT fields from indexName/type WHERE conditions

You can also query several types and indices at once, like this:
SELECT fields from indexName/type1,indexName/type2 WHERE conditions ####Sql Statements

  • SQL Select
  • SQL Delete
  • SQL Where
  • SQL Order By
  • SQL Group By
  • SQL Limit (default is 200)

####Conditions:

  • SQL Like
  • SQL AND & OR
  • SQL COUNT distinct
  • SQL In
  • SQL Between
  • SQL Aliases
  • SQL(ES) Date
  • SQL now()
  • SQL NOT

####Basic aggregations:

  • SQL avg()
  • SQL count()
  • SQL last()
  • SQL max()
  • SQL min()
  • SQL sum()

Examples:

SELECT * FROM bank WHERE age >30 AND gender = 'm'
SELECT * FROM bank/account ORDER BY balance DESC LIMIT 500
SELECT count(*),avg(balance) FROM bank/account

⚠️ **GitHub.com Fallback** ⚠️