# Error sql api index name with '-'

**URL:** <https://discuss.elastic.co/t/error-sql-api-index-name-with/137213>\
**Category:** Elasticsearch\
**Created:** [June 25, 2018, 8:28am UTC](https://discuss.elastic.co/t/error-sql-api-index-name-with/137213 "2018-06-25T08:28:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rendiya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rendiya/32/32639_2.png) [@rendiya](https://discuss.elastic.co/u/rendiya)\
**Post date:** [June 25, 2018, 8:28am UTC](https://discuss.elastic.co/t/error-sql-api-index-name-with/137213/1 "2018-06-25T08:28:57Z")

</div>

hello everyone..  
i'm interesting in sql api in elasticsearch 6.3 but error found with index name with '-'

example

```
/_search/index-example

```

query sql

```
curl --request POST \
--url http://localhost:9200/_xpack/sql/translate \
--header 'content-type: application/json' \
--data '{
"query": "SELECT * FROM index-example",
"fetch_size": 10
}'

```

error found

```
{
"error": {
	"root_cause": [
		{
			"type": "parsing_exception",
			"reason": "line 1:20: mismatched input '-' expecting {<EOF>, ',', 'FULL', 'GROUP', 'HAVING', 'INNER', 'JOIN', 'LEFT', 'LIMIT', 'NATURAL', 'ORDER', 'RIGHT', 'WHERE'}"
		}
	],
	"type": "parsing_exception",
	"reason": "line 1:20: mismatched input '-' expecting {<EOF>, ',', 'FULL', 'GROUP', 'HAVING', 'INNER', 'JOIN', 'LEFT', 'LIMIT', 'NATURAL', 'ORDER', 'RIGHT', 'WHERE'}",
	"caused_by": {
		"type": "input_mismatch_exception",
		"reason": null
	}
},
"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:** [June 25, 2018, 11:34pm UTC](https://discuss.elastic.co/t/error-sql-api-index-name-with/137213/2 "2018-06-25T23:34:58Z")

</div>

Hi @rendiya,  
You need to escape the index name, if the index contains "reserved" characters:

```auto
"query": "SELECT * FROM \"index-example\""

```

---

<div class="post-metadata">

**Author:** ![rendiya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rendiya/32/32639_2.png) [@rendiya](https://discuss.elastic.co/u/rendiya)\
**Post date:** [June 26, 2018, 5:40am UTC](https://discuss.elastic.co/t/error-sql-api-index-name-with/137213/3 "2018-06-26T05:40:24Z")

</div>

oke thank you,... i think in mysql don't support '-' for table name and i replace with \_ and work it

---

<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:** [July 24, 2018, 5:48am UTC](https://discuss.elastic.co/t/error-sql-api-index-name-with/137213/4 "2018-07-24T05:48:38Z")

</div>

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