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

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:

{
  "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.

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