在使用elasticsearch-sql功能时,查询包含“-”的索引时会报错,经过网上查询,得知可以将索引名称用双引号包含起来,然后对该双引号转义,curl命令如下:
curl -X POST "localhost:9200/_xpack/sql?format=txt" -H 'Content-Type: application/json' -d'
{
"query": "SELECT * FROM \"gsm-2019.07\" WHERE begintime = '20190724004259'"
}
'
其中,gsm-2019.07为我测试的索引名称
elasticsearch版本:6.7.0
在此做一下记录,备忘!
参考链接:
http://www.sohu.com/a/239768868_827544