Hi Marco and welcome to the Elastic community!
You are on the right track, but in order for the title
field to be analyzed with the italian_full
analyzer (and support stemming in Italian), you need to explicitly specify that in the field's mapping when you create the index:
PUT index_it
{
"settings": { ... }, // your settings as above
"mappings": {
"properties": {
"title": {
"type": "text",
"analyzer": "italian_full"
}
}
}
}
This configures two things: 1. title
will be analyzed with italian_full
, rather than with the default analyzer, and 2. queries against title
will also be analyzed with italian_full
, so you can run searches in Italian.
PUT index_it/_doc/1
{
"title": "torta"
}
GET index_it/_search
{
"query": {
"match": {
"title": "torte"
}
}
}
{
...
"hits": [
{
"_index": "index_it",
"_id": "1",
"_score": 0.2876821,
"_source": {
"title": "torta"
}
}
]
}
For more info, please check out this guide on specifying an analyzer.
If you want the Italian analyzer to apply to multiple fields in the index by default (e.g. to all text fields), consider using an index template.