Hi,
I’m facing an issue with implementing stop-words and synonyms on title and description fields. While the synonym works well, the stop-words filter fails. I have defined two custom analyzers namely, NGRAM and SYNONYMS.
The definition of analysers;
{
"synonmizeindex2": {
"settings": {
"index": {
"analysis": {
"filter": {
"stopword": {
"type": "stop",
"stopwords_path": "settings/Stop_Words.txt"
},
"synonym": {
“ignore_case": "true",
"type": "synonym",
"synonyms_path": "settings/Synonyms_Words.txt"
}
},
"analyzer": {
"synonym_analyzer": {
"filter": [
“synonym"
],
"tokenizer": "whitespace"
},
"ngram": {
"filter": [
"lowercase",
“asciifolding",
"stopword",
"kstem"
],
"char_filter": [
"whitespace_mapping"
],
"type": "custom",
"tokenizer": "standard"
},
"phrase": {
"filter": [
"lowercase"
],
"char_filter": [
"whitespace_mapping"
],
"type": "custom",
"tokenizer": "standard"
}
}
}
}
}
}
}
The custom analyzers are mapped to the title and description fields respectively. Below is the mapping for the same.
{
"description": {
"type": "text",
"fields": {
"ngrammed": {
"type": "text",
"analyzer": "ngram"
},
"synonymize": {
"type": "text",
"analyzer": "synonym_analyzer"
}
},
"analyzer": "phrase"
},
{
"title": {
"type": "text",
"fields": {
"ngrammed": {
"type": "text",
"analyzer": "ngram"
},
"synonymize": {
"type": "text",
"analyzer": "synonym_analyzer"
}
},
"analyzer": "phrase"
},
Below is my query,
"query": {
"query_string": {
"query": "("and") AND (*)",
"fields": [
"description.synonymize",
"description.ngrammed",
"tags",
"title"
]
}
}
The issue now is, the synonyms works fine. However the stop-words isn’t working. The String defined in stop-words are being indexed. I need both, stop-words and synonyms to be implemented on title and description fields.
What am I doing incorrect here, please suggest.