Synonym sets are limited to a maximum of 100,000 synonym rules per set by default.
This limit is configurable using the synonyms.max_synonym_rules cluster setting.
When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set.
For practical examples of how to create or update a synonyms set, refer to the External documentation.
Required authorization
- Cluster privileges:
manage_search_synonyms
Query parameters
-
If
true, the provided synonym rules are appended to the existing set, with matching IDs overwriting existing rules. Iffalse, the entire synonyms set is replaced with the new synonym rules definitions.
PUT
/_synonyms/{id}
Console
PUT _synonyms/my-synonyms-set
{
"synonyms_set": {
"synonyms" : "hello, hi, howdy"
}
}
resp = client.synonyms.put_synonym(
id="my-synonyms-set",
synonyms_set={
"synonyms": "hello, hi, howdy"
},
)
const response = await client.synonyms.putSynonym({
id: "my-synonyms-set",
synonyms_set: {
synonyms: "hello, hi, howdy",
},
});
response = client.synonyms.put_synonym(
id: "my-synonyms-set",
body: {
"synonyms_set": {
"synonyms": "hello, hi, howdy"
}
}
)
$resp = $client->synonyms()->putSynonym([
"id" => "my-synonyms-set",
"body" => [
"synonyms_set" => [
"synonyms" => "hello, hi, howdy",
],
],
]);
curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"synonyms_set":{"synonyms":"hello, hi, howdy"}}' "$ELASTICSEARCH_URL/_synonyms/my-synonyms-set"
client.synonyms().putSynonym(p -> p
.id("my-synonyms-set")
.synonymsSet(s -> s
.synonyms("hello, hi, howdy")
)
);
Request example
{
"synonyms_set": {
"synonyms" : "hello, hi, howdy"
}
}