SQL Query special chars


#1

Hi there
I have a index called "index-460". When I do SQL query request like:

 POST _xpack/sql
 {
   "query":"DESCRIBE index-460"
 }

I get the response:

 {
   "error": {
     "root_cause": [
       {
         "type": "parsing_exception",
         "reason": "line 1:15: mismatched input '-' expecting <EOF>"
       }
     ],
     "type": "parsing_exception",
     "reason": "line 1:15: mismatched input '-' expecting <EOF>",
     "caused_by": {
       "type": "input_mismatch_exception",
       "reason": null
     }
   },
   "status": 400
 }

How can I get around this error? Renaming the index isn't really an option.
Is there any way I can set index-460 explicit as a string?


#2

I found the problem. I had to enclose the index with " and then escape it with \".
At the end the query looked like this:

POST _xpack/sql
 {
   "query":"DESCRIBE \"index-460\""
 }

(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.