Search code examples
elasticsearchelasticsearch-mappingelasticsearch-analyzers

Elasticsearch Update mapping Analyzer


i tried to update mapping from CURL with many filter's setting. In fact, i want optimized my elasticsearch for have better result in French

I use Elasticsearch 7.0.1 I also use Rufli/Elastica on PHP7.4 on symfony 4.3

curl -XPUT 'localhost:9200/products/_mapping' -H 'Content-Type: application/json' -d '{
"settings": {
"index":{
"analysis": {
"filter": {
"french_elision": {
"type": "elision","articles_case": true,"articles": ["l", "m", "t", "qu", "n", "s", "j", "d", "c", "jusqu", "quoiqu", "lorsqu", "puisqu"]
},"french_synonym": {
"type": "synonym","ignore_case": true,"expand": true,"synonyms": []
},"french_stemmer": {
"type": "stemmer","language": "light_french"
}
},"analyzer": {
"french_heavy": {
"tokenizer": "icu_tokenizer","filter": ["french_elision","lowercase","icu_folding","french_synonym","french_stemmer"]
},"french_light": {
"tokenizer": "icu_tokenizer","filter": ["french_elision","icu_folding"]
}
}
}
}
}
}'

Error:

{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters

Solution

  • Since you're updating the settings and not the mappings, you need to use the _settings endpoint not the _mapping one:

    curl -XPUT 'localhost:9200/products/_settings' -H 'Content-Type: application/json' -d '{
                                            ^
                                            |
                                       change this