I have been trying to implement snowball analyzer like functionality on one of my doc fields which is of type keyword
. Like, for example plurals should be treated exactly like their singulars so that results are same for both.
Initially, I struggled setting analyzer on my field just to discover that fields of type keyword
cannot have analyzers but normalizers. So, I tried setting a normalizer for snowball
on those fields but it seems like my normalizer is not allowing the snowball
filter (may be normalizers don't support the snowball filter)
I can't change the type of the field. I want to achieve functionality like if my input text matches restaurants it should treat it same as restaurant
and give the results so that I don't have to add restaurants as a keyword to that field.
Can we achieve this through normalizers? I have gone through the elastic documentations and various posts but got no clue. Below is how I tried setting normalizer with the response from my elastic server.
PUT localhost:9200/db110/_settings
{
"analysis": {
"normalizer": {
"snowball_normalizer": {
"filter": ["lowercase","snowball" ]
}
},
"filter" : {
"snow" : {
"type" : "snowball",
"language" : "English"
}
}
}
}
Response
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Custom normalizer [snowball_normalizer] may not use filter [snowball]"
}
],
"type": "illegal_argument_exception",
"reason": "Custom normalizer [snowball_normalizer] may not use filter [snowball]"
},
"status": 400
}