Search as you type for documents with digits, unicode and special characters

Hi @zdebyman

Perhaps this example could be a good place to start. You say you want to have a search-as-you-type autocomplete but I don't see the search-as-you-type in your mapping.

The example below uses your char filter + search-as-you-type. Maybe with some changes you can already get the expected results.

Mapping:

PUT test
{
  "settings": {
    "analysis": {
      "char_filter": {
        "my_char_filter": {
          "type": "mapping",
          "mappings": [
            "' => ",
            "’ => "
          ]
        }
      },
      "analyzer": {
        "autocomplete": {
          "type": "custom",
          "tokenizer": "standard",
          "char_filter": [
            "my_char_filter"
          ],
          "filter": [
            "lowercase",
            "asciifolding"
          ]
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "my_field": {
        "type": "search_as_you_type",
        "analyzer": "autocomplete"
      }
    }
  }
}

Docs:

POST test/_bulk
{"index":{}}
{"my_field":"O/Purist Tsipouro"}
{"index":{}}
{"my_field":"Southside"}
{"index":{}}
{"my_field":"South Side"}
{"index":{}}
{"my_field":"Bénédictine"}
{"index":{}}
{"my_field":"Piña Colada"}
{"index":{}}
{"my_field":"Bee's Knees"}
{"index":{}}
{"my_field":"Beer"}
{"index":{}}
{"my_field":"49th Street"}
{"index":{}}
{"my_field":"49 Warriors"}
{"index":{}}
{"my_field":"3 Dolla"}

Query

GET test/_search
{
  "query": {
    "multi_match": {
      "query": "bee's",
      "type": "bool_prefix",
      "fields": [
        "my_field",
        "my_field._2gram",
        "my_field._3gram"
      ]
    }
  }
}