score synonyms equally in Elasticsearch score synonyms equally in Elasticsearch elasticsearch elasticsearch

score synonyms equally in Elasticsearch


Adding mapping while creating index did the job. Without the mapping, the synonym token filter was not even being applied. Below is the command I used to create index.

curl -XPUT 'localhost:9200/test1?pretty' -H 'Content-Type: application/json' -d' {"settings" : {  "analysis":{    "filter":{      "my_metaphone":{        "type":"phonetic",        "encoder":"metaphone",        "replace":false      },      "synonym" : {        "type" : "synonym",         "synonyms_path" : "synonym.txt",        "ignore_case" : "true"      }    },    "analyzer":{      "my_analyzer":{        "type":"custom",        "tokenizer":"standard",        "filter":["asciifolding", "standard", "lowercase", "my_metaphone", "synonym"]      }    }  }},"mappings": {  "test": {    "properties": {      "text": {        "type": "text",        "analyzer": "my_analyzer",         "search_analyzer": "my_analyzer"       }    }  }}}'