Does search_as_you_type and completion work with accent?

Hello,

I’m following this documentation : Autocomplete - OpenSearch documentation

i’m unable to use search_as_you_type or completion with french title and accent like “é”.

For example “ecureuil”, “Ecureuil” and “écureuil” are 3 differents words for suggest / autocomplete and i don’t have the same result.

But with a french_standard analyser and a match_phrase_prefix request, it’s working, theses 3 words “ecureuil”, “Ecureuil” and “écureuil” are the same and i have all the results i need.

My mapping index :

 "analyzer": {
        "french_standard": {
          "tokenizer": "standard",
          "filter": ["lowercase", "asciifolding", "french_synonyms", "french_stop"]
        },
[...]
"title_fre": {
        "type": "text",
        "analyzer": "french_standard",
        "fields": {
          "suggest": {
            "type": "search_as_you_type"
          },
          "completion": {
            "type": "completion"
          },
          "keyword": { 
            "type": "keyword"
          }
        }
      },

Did i miss something ?

Thanks

Your title_fre.sugest field is effectively a different field than your title_fre, it’s just that you get a copy_to for free. So you’ll have to specifically put your french_standard analyzer under suggest, too.

I think (and hope :blush: ) this will fix it.

I tried this :


{
  "suggest": {
    "product-suggestions": {
      "prefix": "ecur",
      "completion": {
        "field": "title_fre.completion",
        "analyzer": "french_standard"
      }
    }

or

{
  "suggest": {
    "product-suggestions": {
      "prefix": "écur",
      "completion": {
        "field": "title_fre.completion",
        "analyzer": "french_standard"
      }
    }

and i don’t have suggestions wtih accent in seconde case.

so i try

{
  "query": {
    "multi_match": {
      "query": "ecur",
      "type": "bool_prefix",
      "fields": [
        "title_fre.suggest",
        "title_fre.suggest._2gram",
        "title_fre.suggest._3gram"
      ],
      "analyzer": "french_standard"
    }
  }
}

with écur or ecur and this one is not working, i can’t get results with é or e in first position of word “écureuil”

If i change analyzer to search_analyzer i have an error : "[multi_match] query does not support [search_analyzer]"

Ah, sorry, I meant that you have to put the analyzer in the mapping. Which requires you to re-create the index and re-index the data. This way, your suggest field will be analyzed how you intend.

The query will, by default, pick up that analyzer. You’ll specify a different analyzer at query time only if you need a different analyzer than the default.

But with the original mapping, you’re efectively using the standard analyzer for the suggest subfield, it doesn’t pick it up from the title_fre parent.