我尝试了一些查询,发现有些SQL查询可以工作,而有些则不能。
我使用开发工具上传了测试数据。我也上传了几百份文件(crwaler(。
PUT /library/book/_bulk?refresh&pretty
{"index":{"_id": "Leviathan Wakes"}}
{"name": "Leviathan Wakes", "author": "James S.A. Corey", "release_date": "2011-06-02", "page_count": 561}
{"index":{"_id": "Hyperion"}}
{"name": "Hyperion", "author": "Dan Simmons", "release_date": "1989-05-26", "page_count": 482}
{"index":{"_id": "Dune"}}
{"name": "Dune", "author": "Frank Herbert", "release_date": "1965-06-01", "page_count": 604}
- 这可以正确工作并显示索引
SHOW tables LIKE %;
.kibana_1
cwl-2021.01.05
library
- 这同样有效。显示42条记录
select * from .kibana_1;
如预期:
select * from library where page_count > 500 and name = 'Dune'
- 这不起作用:
select * from cwl-2021.01.05
获得错误";没有响应";
- 这很有效,但在400条记录中只显示200条:
select * from cwl*
- 只有当ID在前200条记录内时,这才有效:
select * from cwl* where requestID = '3FB4131539FD4403'
管道查询语言仅与库索引一起按预期工作。
search source=library page_count > 500 and name = 'Dune'
它不适用于其他指数,如.kiban_1或cwl-2021.01.05
我不确定在AWS弹性搜索实例中如何支持SQL和PPL。
您可以始终对此用户案例使用backtick。例如
POST /_opendistro/_ppl
{
"query": """
source=`filebeat-7.10.0-2020.11.28`
"""
}
有关使用特殊字符分隔标识符的信息,请参阅本参考资料。
https://github.com/opendistro-for-elasticsearch/sql/blob/develop/docs/experiment/ppl/general/identifiers.rst#delimited-标识符
更多文档:
Sql:https://github.com/opendistro-for-elasticsearch/sql/blob/develop/docs/user/index.rst
Ppl:https://github.com/opendistro-for-elasticsearch/sql/blob/develop/docs/experiment/ppl/index.rst
贡献:https://github.com/opendistro-for-elasticsearch/sql/blob/develop/docs/developing.rst
论坛:https://discuss.opendistrocommunity.dev/c/sql/8
Sql/pll:都是在开源环境中开发的,并在aws服务中按原样使用。
这是因为SQL和PPL不喜欢表名中的点或破折号等特殊字符。
PUT /cwl-2021.01.06/_alias/cwl20210106
PUT /cwl-2021.01.07/_alias/cwl20210107
我创建了一个别名,现在一切似乎都如预期的那样工作。
从cwl20210107中选择*,其中eventID='xxx'限制100
所有节拍、爬网程序(默认情况下(的索引名称中都有特殊字符。更改索引名称并不容易。:(