Hi Team,
I got stuck in very interesting issue.
I have implemented synonyms feature in my index, its working fine.
in my synonyms file, i have oil, lube,lubricate.
when I search with oil, Es is automatically searching for lube & lubricate,it's working as expected.
But the problem is when I search with oil filter term its hitting the document which contains lube filter as well I don't want this to happen is there any filter/analyzer which will search with the given words excluding its synonyms.
Here is the setting and mapping
"filter": {
"synonym": {
"type": "synonym",
"synonyms_path": "D:\MyElasticSearch\elasticsearch-1.5.2\config\synonymsnew.txt",
"ignore_case": "true"
},
"analyzer": {
"synonym": {
"filter": [
"synonym"
],
"tokenizer": "whitespace"
Here is my mapping
"BrandName": {
"type": "string",
"index_analyzer": "synonym",
"search_analyzer": "standard",
"fields": {
"raw": {
"type": "string"
}
},
And My search query is this
GET /_search
{
"query": {
"bool": {
"must": [
{
"query_string": {
"query": "oil filter",
"default_operator": "AND"
}
}
]
}
}
}