# Special Character Search in Elasticsearch

**URL:** <https://discuss.elastic.co/t/special-character-search-in-elasticsearch/86654>\
**Category:** Elasticsearch\
**Created:** [May 22, 2017, 10:37am UTC](https://discuss.elastic.co/t/special-character-search-in-elasticsearch/86654 "2017-05-22T10:37:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phani\_Nadiminti](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/phani_nadiminti/32/45381_2.png) [@Phani\_Nadiminti](https://discuss.elastic.co/u/Phani_Nadiminti)\
**Post date:** [May 22, 2017, 10:37am UTC](https://discuss.elastic.co/t/special-character-search-in-elasticsearch/86654/1 "2017-05-22T10:37:11Z")

</div>

Hi All,

I have a nested type document with following structure.

indexName  
-- mapping  
-- header  
-- nested  
-- details is neted in that i have documents like  
[{  
sub doc 1  
},  
{  
sub doc 2  
}] etc..

Now i am checking a query on the text with in details nested field which is using wild card "_813-0198_" the documents belongs to this field has values like 813-0198-112,813-0198-34etc...  
if i search with "_813-0198_" with nested query can i get the all values contains this string or do we need any special analyzer to search special characters in nested type?please help me in this

Thanks  
phani

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [May 26, 2017, 2:31pm UTC](https://discuss.elastic.co/t/special-character-search-in-elasticsearch/86654/2 "2017-05-26T14:31:31Z")

</div>

This is largely unrelated to the nested structure; it boils down to how the fields were analyzed.

Under the default analyzer (`standard`), hyphens are stripped out when the strings are tokenized. For example, `813-0198-112` will be tokenized into `[" 813", "0198", "112"]`

Similarly, when you search for `"813-0198"`, that'll be tokenized into `["813", "0198"]`. So you'll find any document that contained `"813"` OR `"0198"`.

If you don't want that behavior, you'll need to configure an analyzer that doesn't tokenize on hyphens (and other special characters that you care about).

---

<div class="post-metadata">

**Author:** ![Phani\_Nadiminti](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/phani_nadiminti/32/45381_2.png) [@Phani\_Nadiminti](https://discuss.elastic.co/u/Phani_Nadiminti)\
**Post date:** [May 31, 2017, 2:25pm UTC](https://discuss.elastic.co/t/special-character-search-in-elasticsearch/86654/3 "2017-05-31T14:25:29Z")

</div>

Hi ,

Thank you for the reply. I am using full text search on this i.e "text". I am using ES 5.1.1 but it is not working as expected can you please tell me in full text search scenario is it possible to make wild card search?

phani

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [June 1, 2017, 6:14pm UTC](https://discuss.elastic.co/t/special-character-search-in-elasticsearch/86654/4 "2017-06-01T18:14:20Z")

</div>

I suggest you start reading through the [Mapping and Analysis](https://www.elastic.co/guide/en/elasticsearch/guide/current/mapping-analysis.html) portion of the Definitive Guide, as well as the [Analysis docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis.html).

The subject is a bit too broad to cover in a forum reply, but the Guide and docs will help you start to understand how mapping/analysis works.

---

<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:** [June 29, 2017, 6:14pm UTC](https://discuss.elastic.co/t/special-character-search-in-elasticsearch/86654/5 "2017-06-29T18:14:27Z")

</div>

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