# Kibana SQL Query Index with -

**URL:** <https://discuss.elastic.co/t/kibana-sql-query-index-with/203668>\
**Category:** Elasticsearch\
**Created:** [October 15, 2019, 2:12pm UTC](https://discuss.elastic.co/t/kibana-sql-query-index-with/203668 "2019-10-15T14:12:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Srini12](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@Srini12](https://discuss.elastic.co/u/Srini12)\
**Post date:** [October 15, 2019, 2:12pm UTC](https://discuss.elastic.co/t/kibana-sql-query-index-with/203668/1 "2019-10-15T14:12:00Z")

</div>

Good day,  
I have a wired situation, my elastic index name contains '-' (ex: my-index-2019)  
I am trying to query using sql syntax, but it complaining about the '-' in the index name.  
Any ideas.? how to sort out this. Below is my request and response from Kibana

POST /\_sql?format=txt  
{  
"query":"SELECT \* FROM my-index-2019"  
}

{  
"error": {  
"root\_cause": [  
{  
"type": "parsing\_exception",  
"reason": "line 1:18: extraneous input '-' expecting {, ',', 'ANALYZE', 'ANALYZED', 'AS', 'CATALOGS', 'COLUMNS', 'CURRENT\_DATE', 'CURRENT\_TIME', 'CURRENT\_TIMESTAMP', 'DAY', 'DEBUG', 'EXECUTABLE', 'EXPLAIN', 'FIRST', 'FORMAT', 'FULL', 'FUNCTIONS', 'GRAPHVIZ', 'GROUP', 'HAVING', 'HOUR', 'INNER', 'INTERVAL', 'JOIN', 'LAST', 'LEFT', 'LIMIT', 'MAPPED', 'MINUTE', 'MONTH', 'NATURAL', 'OPTIMIZED', 'ORDER', 'PARSED', 'PHYSICAL', 'PLAN', 'RIGHT', 'RLIKE', 'QUERY', 'SCHEMAS', 'SECOND', 'SHOW', 'SYS', 'TABLES', 'TEXT', 'TYPE', 'TYPES', 'VERIFY', 'WHERE', 'YEAR', '{LIMIT', IDENTIFIER, DIGIT\_IDENTIFIER, QUOTED\_IDENTIFIER, BACKQUOTED\_IDENTIFIER}"  
}  
],  
"type": "parsing\_exception",  
"reason": "line 1:18: extraneous input '-' expecting {, ',', 'ANALYZE', 'ANALYZED', 'AS', 'CATALOGS', 'COLUMNS', 'CURRENT\_DATE', 'CURRENT\_TIME', 'CURRENT\_TIMESTAMP', 'DAY', 'DEBUG', 'EXECUTABLE', 'EXPLAIN', 'FIRST', 'FORMAT', 'FULL', 'FUNCTIONS', 'GRAPHVIZ', 'GROUP', 'HAVING', 'HOUR', 'INNER', 'INTERVAL', 'JOIN', 'LAST', 'LEFT', 'LIMIT', 'MAPPED', 'MINUTE', 'MONTH', 'NATURAL', 'OPTIMIZED', 'ORDER', 'PARSED', 'PHYSICAL', 'PLAN', 'RIGHT', 'RLIKE', 'QUERY', 'SCHEMAS', 'SECOND', 'SHOW', 'SYS', 'TABLES', 'TEXT', 'TYPE', 'TYPES', 'VERIFY', 'WHERE', 'YEAR', '{LIMIT', IDENTIFIER, DIGIT\_IDENTIFIER, QUOTED\_IDENTIFIER, BACKQUOTED\_IDENTIFIER}"  
},  
"status": 400  
}

---

<div class="post-metadata">

**Author:** ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)\
**Post date:** [October 16, 2019, 7:23am UTC](https://discuss.elastic.co/t/kibana-sql-query-index-with/203668/2 "2019-10-16T07:23:38Z")

</div>

@Srini12 the index name should be [escaped](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/sql-lexical-structure.html#sql-syntax-single-vs-double-quotes): `SELECT * FROM \"my-index-2019\"` as in `"query":"SELECT * \"FROM my-index-2019\""`.

---

<div class="post-metadata">

**Author:** ![Srini12](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@Srini12](https://discuss.elastic.co/u/Srini12)\
**Post date:** [October 18, 2019, 9:14am UTC](https://discuss.elastic.co/t/kibana-sql-query-index-with/203668/3 "2019-10-18T09:14:51Z")

</div>

Thank you Andrei.  
Worked for me.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 15, 2019, 9:15am UTC](https://discuss.elastic.co/t/kibana-sql-query-index-with/203668/4 "2019-11-15T09:15:04Z")

</div>

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