July 2015
Intermediate to advanced
192 pages
3h 38m
English
Elasticsearch considers synonyms while searching. This means that if you search for the word "big", a document would be matched even if any of the synonyms of the word big, such as "large", are present in that document.
Let's see how we can implement a simple synonym filter and how it works under the hood:
curl -X PUT "http://localhost:9200/news" -d '{
"analysis": {
"filter": {
"synonym": {
"type": "synonym",
"synonyms": [
"big, large",
"round, circle"
]
}
},
"analyzer": {
"synonymAnalyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"synonym"
]
}
}
}
}'Here, we created a synonym filter and provided a set of synonyms in it. Elasticsearch does not have a standard dictionary of synonyms so we need ...
Read now
Unlock full access