When i do a search without accent, i don't have a match with the same words which have an accent in spite of i set a french analyzer in mapping
This is my mapping:
PUT /test12h31
{
"mappings": {
"proj": {
"properties": {
"movieTitle": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
},
"analyzer": "french"
}
}
}
}
}
I enter data with:
PUT /test12h31/proj/_search
{
"movieTitle":"Le Retour Du Héros"
}
And i have no result when i do this search:
POST /test12h31/proj/_search
{
"query": {
"match": {
"movieTitle": "hero"
}
}
}
When i replace "hero" by "héro" in my search request i have a result.
Could you help me to understand what happens and how to ignore accents please?
The french analyzer doesn't take care of accents, for that you need to include the asciifolding token filter.
I suggest you modify your index settings and mapping like this in order to redefine the french analyzer to include the asciifolding token filter:
PUT /test12h31
{
"settings": {
"analysis": {
"filter": {
"french_elision": {
"type": "elision",
"articles_case": true,
"articles": [
"l", "m", "t", "qu", "n", "s",
"j", "d", "c", "jusqu", "quoiqu",
"lorsqu", "puisqu"
]
},
"french_stop": {
"type": "stop",
"stopwords": "_french_"
},
"french_stemmer": {
"type": "stemmer",
"language": "light_french"
}
},
"analyzer": {
"french": {
"tokenizer": "standard",
"filter": [
"french_elision",
"lowercase",
"asciifolding",
"french_stop",
"french_stemmer"
]
}
}
}
},
"mappings": {
"proj": {
"properties": {
"movieTitle": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
},
"analyzer": "french"
}
}
}
}
}
}
Then you'll get results for your search.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With