opendistro-for-elasticsearch / sql

🔍 Open Distro SQL Plugin
https://opendistro.github.io/for-elasticsearch/features/SQL%20Support.html
Apache License 2.0
620 stars 186 forks source link

SQL Cursor Enabling breaks queries #1115

Open josephteddick opened 3 years ago

josephteddick commented 3 years ago

Hi everyone. I am trying to make use of cursor for the opendistro SQL plugin. First, as an example--without enabling it, the follow curl command runs perfectly fine:

curl --user 'username':'password' -H 'Content-Type: application/json' -X POST "request_url" -d '{

"query" : "select * from index-name.2021-05-19" }'

But, as expected, if I try sending in a parameter used in cursor:

curl --user 'username':'password' -H 'Content-Type: application/json' -X POST "request_url" -d '{ "fetch_size" : 5, "query" : "select * from index-name.2021-05-19" }'

It fails with this message:

{ "error": { "reason": "Invalid SQL query", "details": "Field [index-name.2021-05-19] cannot be found or used here.", "type": "SemanticAnalysisException" }, "status": 400 }%

So I went to enabled it with the following command in the Dev Tools console in Kibana:

PUT _cluster/settings { "transient" : { "opendistro.sql.cursor.enabled" : true } }

While that appeared to work, it actually breaks my Query workbench where I can't run any SQL commands--and both of the above curl commands return the following error:

{ "error": { "reason": "Invalid SQL query", "details": "Field [index-name.2021-05-19] cannot be found or used here.", "type": "SemanticAnalysisException" }, "status": 400 }%

I tried to disable query analysis with:

PUT _cluster/settings { "transient" : { "opendistro.sql.query.analysis.enabled" : false } }

But after doing that the error I get is:

{ "error": { "reason": "Error occurred in Elasticsearch engine: no such index [index-name.2021-05-19]", "details": "org.elasticsearch.index.IndexNotFoundException: no such index [index-name.2021-05-19]\nFor more details, please send request for Json format to see the raw response from elasticsearch engine.", "type": "IndexNotFoundException" }, "status": 404 }%

This doesn't make sense as the index does exist.

Any help would be appreciated!

abbashus commented 3 years ago

What ODFE version you are using? Are you using this plugin with Elasticsearch distribution or ODFE distribution ? What version of either of them?

Lets us try to reproduce this from our end.

josephteddick commented 3 years ago

@abbashus

I'm using ODFE distribution version 1.13.0 and the Elastic version with this is 7.10.2