免费注册
帮助文档(华北一、二)

  • 可以使用户以类SQL语法查询、分析存储在Elasticsearch中的数据。

    Basic Usage

    Simple query

     /_sql?sql=select * from indexName limit 10

    Explain SQL to elasticsearch query DSL

     /_sql/_explain?sql=select * from indexName limit 10

    SQL Usage

    Query

     SELECT * FROM bank WHERE age > 30 AND gender = 'm'

    Aggregation

     
    select COUNT(*),SUM(age),MIN(age) as m, MAX(age),AVG(age) FROM bank GROUP 
    BY gender ORDER BY SUM(age), m DESC

    Delete

     DELETE FROM bank WHERE age > 30 AND gender = 'm'

    Beyond sql

    Search

     
    SELECT address FROM bank WHERE address = matchQuery('880 Holmes Lane') 
    ORDER BY _score DESC LIMIT 3

    Aggregations

     
    # range age group 20-25,25-30,30-35,35-40 
    SELECT COUNT(age) FROM bank GROUP BY range(age, 20,25,30,35,40) 
    # range date group by day 
    SELECT online FROM online GROUP BY 
    date_histogram(field='insert_time','interval'='1d') 
    # range date group by your config 
    SELECT online FROM online GROUP BY 
    date_range(field='insert_time','format'='yyyy-MM-dd' ,'2014-08-18','2014-
    08-17','now-8d','now-7d','now-6d','now')

    ES Geographic

     SELECT * FROM locations WHERE GEO_BOUNDING_BOX(fieldname,100.0,1.0,101,0.0)

    Select type

     SELECT * FROM indexName/type

    该插件来自开源项目,参考链接:

    https://github.com/NLPchina/elasticsearch-sql


文档是否已解决您的问题?

  已解决   未解决

如您有其它疑问,您也可以与我们技术专家联系探讨。

联系技术专家