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.
manage_search_synonymsIf true, the request will refresh the analyzers with the new synonym rule and wait for the new synonyms to be available before returning.
If false, analyzers will not be reloaded with the new synonym rule
PUT _synonyms/my-synonyms-set/test-1
{
"synonyms": "hello, hi, howdy"
}
resp = client.synonyms.put_synonym_rule(
set_id="my-synonyms-set",
rule_id="test-1",
synonyms="hello, hi, howdy",
)
const response = await client.synonyms.putSynonymRule({
set_id: "my-synonyms-set",
rule_id: "test-1",
synonyms: "hello, hi, howdy",
});
response = client.synonyms.put_synonym_rule(
set_id: "my-synonyms-set",
rule_id: "test-1",
body: {
"synonyms": "hello, hi, howdy"
}
)
$resp = $client->synonyms()->putSynonymRule([
"set_id" => "my-synonyms-set",
"rule_id" => "test-1",
"body" => [
"synonyms" => "hello, hi, howdy",
],
]);
curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"synonyms":"hello, hi, howdy"}' "$ELASTICSEARCH_URL/_synonyms/my-synonyms-set/test-1"
{
"synonyms": "hello, hi, howdy"
}
{
"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"
]
}
]
}
}