# How to query special characters

**URL:** <https://discuss.elastic.co/t/how-to-query-special-characters/176114>\
**Category:** Elasticsearch\
**Created:** [April 9, 2019, 9:52pm UTC](https://discuss.elastic.co/t/how-to-query-special-characters/176114 "2019-04-09T21:52:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![samyamoy](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@samyamoy](https://discuss.elastic.co/u/samyamoy)\
**Post date:** [April 9, 2019, 9:52pm UTC](https://discuss.elastic.co/t/how-to-query-special-characters/176114/1 "2019-04-09T21:52:06Z")

</div>

Hi,

I have been trying to search for a full match for "D&H" as a string from website content dumps but the results I have been getting do not seem to have the result at all. what is the correct way of querying? I have tried query string /match and match\_phrase and I have gotten similar results for all. Do we have to set a custom analyzer for this?

Mapping I am using:

{'dev\_web2': {'aliases': {}, 'mappings': {'en': {'properties': {'analyzer': {'type': 'text', 'fields': {'keyword': {'type': 'keyword', 'ignore\_above': 256}}}, 'content': {'type': 'text', 'store': True, 'term\_vector': 'yes', 'analyzer': 'english', 'fielddata': True}, 'domain': {'type': 'keyword'}, 'error': {'type': 'keyword'}, 'ids': {'type': 'text', 'fields': {'keyword': {'type': 'keyword', 'ignore\_above': 256}}}, 'odate': {'type': 'date'}, 'parameters': {'properties': {'\_index': {'type': 'text', 'fields': {'keyword': {'type': 'keyword', 'ignore\_above': 256}}}, '\_type': {'type': 'text', 'fields': {'keyword': {'type': 'keyword', 'ignore\_above': 256}}}, 'field\_statistics': {'type': 'boolean'}, 'fields': {'type': 'text', 'fields': {'keyword': {'type': 'keyword', 'ignore\_above': 256}}}, 'filter': {'properties': {'max\_num\_terms': {'type': 'long'}, 'max\_word\_length': {'type': 'long'}, 'min\_doc\_freq': {'type': 'long'}, 'min\_term\_freq': {'type': 'long'}, 'min\_word\_length': {'type': 'long'}}}, 'offsets': {'type': 'boolean'}, 'payloads': {'type': 'boolean'}, 'positions': {'type': 'boolean'}, 'term\_statistics': {'type': 'boolean'}}}}}}, 'settings': {'index': {'number\_of\_shards': '5', 'blocks': {'write': 'false'}, 'provided\_name': 'dev\_web2', 'creation\_date': '1542418329521', 'number\_of\_replicas': '1', 'uuid': 'EuP2lGHtRrmc6InivOvRxg', 'version': {'created': '6030199'}}}}}

---

<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:** [May 7, 2019, 9:52pm UTC](https://discuss.elastic.co/t/how-to-query-special-characters/176114/2 "2019-05-07T21:52:07Z")

</div>

Closed on May 7, 2019, 9:52pm UTC

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