是否完全支持 SQL 和 PPL?

问题描述

我尝试了一些查询,发现有些 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}
  1. 这可以正常工作并显示索引。
SHOW tables LIKE %;

.kibana_1
cwl-2021.01.05
library
  1. 这也有效。显示 42 条记录。
select * from .kibana_1;

这按预期工作:

select * from library where page_count > 500 and name = 'Dune'
  1. 这不起作用:
select * from cwl-2021.01.05

收到错误“无响应”

  1. 这有效,但只显示 400 条记录中的 200 条:
select * from cwl*
  1. 仅当 ID 在前 200 条记录内时才有效:
select * from cwl* where requestID = '3FB4131539FD4403'

管道查询语言仅适用于库索引。

search source=library page_count > 500 and name = 'Dune'

它不适用于其他索引,例如 .kibana_1 或 cwl-2021.01.05

我不确定 AWS elasticsearch 实例如何支持 sql 和 PPL。

解决方法

请参阅此参考用于界定标识符用于使用特殊字符。

https://github.com/opendistro-for-elasticsearch/sql/blob/develop/docs/experiment/ppl/general/identifiers.rst#delimited-identifiers

更多关于文件:

SQL:https://github.com/opendistro-for-elasticsearch/sql/blob/develop/docs/user/index.rst

人: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/ppl : 都是在开源中开发的,在 aws 服务中按原样使用。

,

对于此用户案例,您始终可以使用反引号。例如

POST /_opendistro/_ppl
{
  "query": """
    source=`filebeat-7.10.0-2020.11.28`
  """
}
,

这是因为 SQL 和 PPL 不喜欢表名中的点或破折号等特殊字符。

PUT /cwl-2021.01.06/_alias/cwl20210106

PUT /cwl-2021.01.07/_alias/cwl20210107

我创建了一个别名,现在一切似乎都按预期工作。

select * from cwl20210107 where eventID = 'xxx' limit 100

所有的节拍、爬虫(默认情况下)在其索引名称中都有特殊字符。更改索引名称并不容易。 :)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...