# How to apply search on special characters when search is limited to specific fields?

**URL:** <https://discuss.elastic.co/t/how-to-apply-search-on-special-characters-when-search-is-limited-to-specific-fields/323220>\
**Category:** Elasticsearch\
**Created:** [January 16, 2023, 6:58am UTC](https://discuss.elastic.co/t/how-to-apply-search-on-special-characters-when-search-is-limited-to-specific-fields/323220 "2023-01-16T06:58:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Moazzam\_Saleem](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/moazzam_saleem/32/115919_2.png) [@Moazzam\_Saleem](https://discuss.elastic.co/u/Moazzam_Saleem)\
**Post date:** [January 16, 2023, 6:58am UTC](https://discuss.elastic.co/t/how-to-apply-search-on-special-characters-when-search-is-limited-to-specific-fields/323220/1 "2023-01-16T06:58:49Z")

</div>

I'm new to elasticsearch, I'm trying to give global search but when I limited my search to apply of specific fields by giving **fields** param in query, search doesn't apply on special characters  
Here is my JSON query:

```auto
{
  "query": {
    "bool": {
      "must": {
        "query_string": {
          "fields": [
            "field_1",
            "field_2",
            "field_3"
          ],
          "query": "*email@test.com*"
        }
      },
      "filter": {
        "term": {
          "owner": 123456789
        }
      }
    }
  }
}

```

Now if field\_1, field\_2 or field\_3 contains special character, then it dosen't return desired result.

I tried to add `.keyword` with every field name. It does start working but this does raise some errors and undesired outputs. I have a field which contains text like **442 567-567** now if the search string contains this whole string then it doesn't give the document which contains it. But If I search **567-567** , it return that document.

---

<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 13, 2023, 6:58am UTC](https://discuss.elastic.co/t/how-to-apply-search-on-special-characters-when-search-is-limited-to-specific-fields/323220/2 "2023-02-13T06:58:55Z")

</div>

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