Delete a synonym rule Generally available; Added in 8.10.0

DELETE /_synonyms/{set_id}/{rule_id}

Delete a synonym rule from a synonym set.

Required authorization

  • Cluster privileges: manage_search_synonyms

Path parameters

  • set_id string Required

    The ID of the synonym set to update.

  • rule_id string Required

    The ID of the synonym rule to delete.

Query parameters

  • refresh boolean Generally available; Added in 9.1.0

    If true, the request will refresh the analyzers with the deleted synonym rule and wait for the new synonyms to be available before returning. If false, analyzers will not be reloaded with the deleted synonym rule

Responses

  • 200 application/json
    Hide response attributes Show response attributes object
    • result string Required

      The update operation result.

      Values are created, updated, deleted, not_found, or noop.

    • reload_analyzers_details object

      Updating synonyms in a synonym set can reload the associated analyzers in case refresh is set to true. This information is the analyzers reloading result.

      Hide reload_analyzers_details attributes Show reload_analyzers_details attributes object
      • reload_details array[object] Required
        Hide reload_details attributes Show reload_details attributes object
        • index string Required
        • reloaded_analyzers array[string] Required
        • reloaded_node_ids array[string] Required
      • _shards object Required
        Hide _shards attributes Show _shards attributes object
        • failed number Required

          The number of shards the operation or search attempted to run on but failed.

        • successful number Required

          The number of shards the operation or search succeeded on.

        • total number Required

          The number of shards the operation or search will run on overall.

        • failures array[object]
        • skipped number
DELETE /_synonyms/{set_id}/{rule_id}
DELETE _synonyms/my-synonyms-set/test-1
resp = client.synonyms.delete_synonym_rule(
    set_id="my-synonyms-set",
    rule_id="test-1",
)
const response = await client.synonyms.deleteSynonymRule({
  set_id: "my-synonyms-set",
  rule_id: "test-1",
});
response = client.synonyms.delete_synonym_rule(
  set_id: "my-synonyms-set",
  rule_id: "test-1"
)
$resp = $client->synonyms()->deleteSynonymRule([
    "set_id" => "my-synonyms-set",
    "rule_id" => "test-1",
]);
curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_synonyms/my-synonyms-set/test-1"
Response examples (200)
A successful response from `DELETE _synonyms/my-synonyms-set/test-1`. All analyzers using this synonyms set will be reloaded automatically to reflect the rule being deleted.
{
  "result": "deleted",
  "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"
        ]
      }
    ]
  }
}