Answer the question
In order to leave comments, you need to log in
How do synonyms work in Elasticsearch?
I am creating an index with a customized parser. I set rules for synonyms.
Example from documentation:
curl -X PUT "localhost:9200/test_index" -H 'Content-Type: application/json' -d'
{
"settings": {
"index" : {
"analysis" : {
"filter" : {
"synonym" : {
"type" : "synonym_graph",
"synonyms" : [
"lol, laughing out loud",
"universe, cosmos"
]
}
}
}
}
}
}
'
curl -X PUT "localhost:9200/test_index/_doc/2?pretty" -H 'Content-Type: application/json' -d'
{
"name": "laughing out loud"
}
'
curl -X GET "localhost:9200/test_index/_search?q=lol&pretty"
name: "laughing out loud"
Answer the question
In order to leave comments, you need to log in
In addition to setting a filter, you also need to create your own analyzer and attach it to the desired field through mapping. Here, in a recent article on Habré, the correct mapping is done - https://habr.com/post/428814/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question