我有一个elasticsearch索引,它的名字是 .
(示例: my_index-2020.11.06-001
). 当我使用sql获取 count
在所有的文档中,我得到了以下错误
curl --location --request POST '127.0.0.1:9200/_opendistro/_sql'
--header 'Content-Type: application/json'
--data-raw '{
"query": "SELECT count(*) FROM my_index-2020.11.06-001"
}'
Failed to parse query due to offending symbol [.11] at: 'SELECT count(*) FROM my_index-2020.11.06-001 ...
我还尝试在索引名中使用反勾号(`)和单引号('),这也没有帮助
curl --location --request POST '127.0.0.1:9200/_opendistro/_sql'
--header 'Content-Type: application/json'
--data-raw '{
"query": "SELECT count(*) FROM `my_index-2020.11.06-001`"
}'
{
"error": {
"reason": "Invalid SQL query",
"details": "Field [my_index-2020.11.06-001] cannot be found or used here.",
"type": "SemanticAnalysisException"
...
有没有别的办法解决这个问题?
暂无答案!
目前还没有任何答案,快来回答吧!