Create or update a synonym rule
Added in 8.10.0
Create or update a synonym rule in a synonym set.
If any of the synonym rules included is invalid, the API returns an error.
When you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule.
PUT
/_synonyms/{set_id}/{rule_id}
curl \
--request PUT 'http://api.example.com/_synonyms/{set_id}/{rule_id}' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '"{\n \"synonyms\": \"hello, hi, howdy\"\n}"'
Request example
{
"synonyms": "hello, hi, howdy"
}
Response examples (200)
A successful response from `PUT _synonyms/my-synonyms-set/test-1`.
{
"result": "updated",
"reload_analyzers_details": {
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"reload_details": [
{
"index": "test-index",
"reloaded_analyzers": [
"my_search_analyzer"
],
"reloaded_node_ids": [
"1wYFZzq8Sxeu_Jvt9mlbkg"
]
}
]
}
}