WIldcard case insensitive query string

I've solved the problem using a normalizer.

Bellow is the mapping of my index, where I've just added a "normalizer" in order to allow queries case insensitive. Also, I'm ignoring accented characters on search on my mapping.

PUT test
{  "settings": {
    "analysis": {
      "analyzer": {
        "folding": {
          "tokenizer": "standard",
          "filter":  [ "lowercase", "asciifolding" ]
        }
      },
      "normalizer": {
        "lowerasciinormalizer": {
          "type": "custom",
          "filter":  [ "lowercase", "asciifolding" ]
        }
      }
    }
  },
  "mappings": {
    "_default_": {
      "dynamic_templates": [
        {
          "string_as_keyword": {
            "match_mapping_type": "string",
            "match":   "*_k",
            "mapping": {
              "type": "keyword",
              "normalizer": "lowerasciinormalizer"                              
            }
          }
         }
      ]
    }
  }
}

PUT test/1/123
{
    "str_k" : "string âgáÈÒU is cool"
}

GET test/_search
{
  "query": {
    "wildcard": {
      "str_k": "*agaeou*"
    }
  }
}
3 Likes