How to add synonym with a forward shash? Error failed to build synonyms.
Your problem is probably due to tokenization. This works for me:
DELETE my_index
PUT my_index
{
"settings": {
"analysis": {
"filter": {
"my_synonym_filter": {
"type": "synonym",
"synonyms": [
"ac/dc => synonym_1"
]
}
},
"analyzer": {
"my_analyzer": {
"tokenizer": "whitespace",
"filter": [
"my_synonym_filter"
]
}
}
}
}
}
POST my_index/_analyze
{
"analyzer" : "my_analyzer",
"text" : "ac/dc"
}
produces:
{
"tokens": [
{
"token": "synonym_1",
"start_offset": 0,
"end_offset": 5,
"type": "SYNONYM",
"position": 0
}
]
}
Yep I tried
"ac/dc, acdc" - it give an error.
ac/dc also doesn't work.
You probably still use the "standard" tokenizer which will split the token on the slash. Also you didn't mention the error you are getting. The example I posted works for me, so in order to help here we'd need more information.