# Not getting proper result while searching special characters in query string

**URL:** <https://discuss.elastic.co/t/not-getting-proper-result-while-searching-special-characters-in-query-string/278875>\
**Category:** Elasticsearch\
**Created:** [July 16, 2021, 9:55am UTC](https://discuss.elastic.co/t/not-getting-proper-result-while-searching-special-characters-in-query-string/278875 "2021-07-16T09:55:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Madhavi](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@Madhavi](https://discuss.elastic.co/u/Madhavi)\
**Post date:** [July 16, 2021, 9:55am UTC](https://discuss.elastic.co/t/not-getting-proper-result-while-searching-special-characters-in-query-string/278875/1 "2021-07-16T09:55:49Z")

</div>

This is my query

```auto
GET /momsarchival1/_search
{
  "track_total_hits": true,
  "query": {
    "bool": {
      "must": [
        {
          "bool": {
            "must": [
              {
                "query_string": {
                  "default_field": 
                    "GECORRIGEERDETOEVOEGING.keyword",
                  "query": "*(a-n)*",
                  "analyze_wildcard": "true",
                  "default_operator": "AND"
               
                }
              }
            ]
          }
        }
      ]
    }
  },
  "_source": ["GECORRIGEERDETOEVOEGING"], 
  "size": 30,
  "from": 0,
  "sort": [
    {
      "ORDERNUMMER.keyword": {
        "order": "asc"
      }
    }
  ]
}

```

This is my index mapping

```auto
{
  "settings": {
    "number_of_shards": 1,
    "analysis": {
      "analyzer": {
        "custom_analyzer": {
          "tokenizer": "custom_tokenizer"
        }
      },
      "tokenizer": {
        "custom_tokenizer": {
          "type": "ngram",
          "min_gram": 2,
          "max_gram": 30,
          "token_chars": [
            "letter",
            "digit",
            "symbol",
            "punctuation"
          ]
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "GECORRIGEERDETOEVOEGING": {
        "type": "text",
        "fields": {
          "formatted": {
            "type": "text",
            "analyzer": "custom_analyzer"
          },
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "GECORRIGEERDISRA": {
        "type": "text",
        "fields": {
          "formatted": {
            "type": "text",
            "analyzer": "standard"
          },
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      }
    }
  }
}

```

---

<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:** [August 13, 2021, 9:56am UTC](https://discuss.elastic.co/t/not-getting-proper-result-while-searching-special-characters-in-query-string/278875/2 "2021-08-13T09:56:37Z")

</div>

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