# Query "-" on fieldname problem

**URL:** <https://discuss.elastic.co/t/query-on-fieldname-problem/254255>\
**Category:** Kibana\
**Tags:** elastic-stack-sql\
**Created:** [November 4, 2020, 10:50am UTC](https://discuss.elastic.co/t/query-on-fieldname-problem/254255 "2020-11-04T10:50:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eurosom](https://avatars.discourse-cdn.com/v4/letter/e/e480ec/32.png) [@Eurosom](https://discuss.elastic.co/u/Eurosom)\
**Post date:** [November 4, 2020, 10:50am UTC](https://discuss.elastic.co/t/query-on-fieldname-problem/254255/1 "2020-11-04T10:50:29Z")

</div>

Hi Support,

We have problem querying file name with "-" for example sts-empId. It is complaining **-** character. Could you please help how to query this?

GET /\_sql?format=txt  
{

"query":" SELECT sts-empId FROM "sts-amsguled-2020.10.27-000001" LIMIT 300"

## }

Error:  
{  
"error": {  
"root\_cause": [  
{  
"type": "x\_content\_parse\_exception",  
"reason": "[3:9] [sql/query] failed to parse field [query]"  
}  
],  
"type": "x\_content\_parse\_exception",  
"reason": "[3:9] [sql/query] failed to parse field [query]",  
"caused\_by": {  
"type": "json\_parse\_exception",  
"reason": "Unrecognized character escape ''' (code 39)\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@57e3e6ab; line: 3, column: 21]"  
}  
},  
"status": 400  
}

---

<div class="post-metadata">

**Author:** ![rudolf](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rudolf/32/51200_2.png) [@rudolf](https://discuss.elastic.co/u/rudolf)\
**Post date:** [November 4, 2020, 11:46am UTC](https://discuss.elastic.co/t/query-on-fieldname-problem/254255/2 "2020-11-04T11:46:15Z")

</div>

The error is saying that you've sent an invalid JSON payload. It sounds like you're sending an escaped single quote `\'` although this error doesn't match your example request body.

Your example has `"` embedded within other quotes `"` which is not valid JSON, you will need to escape the inner quotes:

```auto
curl -X POST "localhost:9200/_sql?format=txt" -H 'Content-Type: application/json' -d'
{
  "query":"SELECT sts-empId FROM \"sts-amsguled-2020.10.27-000001\" LIMIT 300"
}
'

```

---

<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:** [December 2, 2020, 11:46am UTC](https://discuss.elastic.co/t/query-on-fieldname-problem/254255/3 "2020-12-02T11:46:17Z")

</div>

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