# How should I manage hyphen in my request

**URL:** <https://discuss.elastic.co/t/how-should-i-manage-hyphen-in-my-request/216178>\
**Category:** Elasticsearch\
**Created:** [January 23, 2020, 5:01am UTC](https://discuss.elastic.co/t/how-should-i-manage-hyphen-in-my-request/216178 "2020-01-23T05:01:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShreyaBhat](https://avatars.discourse-cdn.com/v4/letter/s/ba9def/32.png) [@ShreyaBhat](https://discuss.elastic.co/u/ShreyaBhat)\
**Post date:** [January 23, 2020, 5:01am UTC](https://discuss.elastic.co/t/how-should-i-manage-hyphen-in-my-request/216178/1 "2020-01-23T05:01:10Z")

</div>

I have tried the following but it does not work if I have a hyphen in my id: [http://localhost:9200/account/useraccounts/\_search?q=id:](http://localhost:9200/account/useraccounts/_search?q=id:)"\* CMRZ\*"  
when I send \<--\> then result is

1-CMRZ-121 \<--\> 1-CMRZ-121

1-CMRZ- \<--\> 1-CMRZ-121 ,1-CMRZ-165

BUT

1-CMR \<--\> NULL RESPONSE

Thus now i know the problem is with the hyphen. Any way of preventing this such that I get the following answer?

1-CMR \<--\> 1-CMRA-971,1-CMRZ-121 ,1-CMRZ-165

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [January 23, 2020, 10:48am UTC](https://discuss.elastic.co/t/how-should-i-manage-hyphen-in-my-request/216178/2 "2020-01-23T10:48:12Z")

</div>

First, you should rather use the query DSL, where the query is stated in the body of a HTTP request, as this prevents confusion or any requirement to URL encode parts of your query.

Second, can you please provide a fully reproducible example? I have no idea, what a query is, what a stored documents looks like, how your mapping or index configuration looks like. Those are all needed.

Thanks!

---

<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:** [February 20, 2020, 10:48am UTC](https://discuss.elastic.co/t/how-should-i-manage-hyphen-in-my-request/216178/3 "2020-02-20T10:48:15Z")

</div>

Closed on February 20, 2020, 10:48am UTC

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