[[delete-synonym-rule]]
=== Delete synonym rule
++++
<titleabbrev>Delete synonym rule</titleabbrev>
++++

.New API reference
[sidebar]
--
For the most up-to-date API details, refer to {api-es}/group/endpoint-synonyms[Synonyms APIs].
--

Deletes an individual synonym rule from a synonyms set.

[[delete-synonym-rule-request]]
==== {api-request-title}

`DELETE _synonyms/<synonyms_set>/<synonym_rule>`

[[delete-synonym-rule-prereqs]]
==== {api-prereq-title}

Requires the `manage_search_synonyms` cluster privilege.

[[delete-synonym-rule-path-params]]
==== {api-path-parms-title}

`<synonyms_set>`::
(Required, string)
Synonyms set identifier to update.

`<synonym_rule>`::
(Required, string)
Synonym rule identifier to delete.

[[delete-synonym-rule-response-codes]]
==== {api-response-codes-title}

`404` (Missing resources)::
The `synonyms_set` identifier was not found, or the synonym rule specified by `synonym_rule` was not found in the synonyms set.


[[delete-synonym-rule-example]]
==== {api-examples-title}

The following example deletes an existing synonym rule called `test-1` for the synonyms set `my-synonyms-set`:

////
[source,console]
----
PUT _synonyms/my-synonyms-set
{
  "synonyms_set": [
    {
      "id": "test-1",
      "synonyms": "hello, hi"
    },
    {
      "synonyms": "bye, goodbye"
    },
    {
      "id": "test-2",
      "synonyms": "test => check"
    }
  ]
}

PUT /test-index
{
  "settings": {
    "analysis": {
      "filter": {
        "synonyms_filter": {
          "type": "synonym_graph",
          "synonyms_set": "my-synonyms-set",
          "updateable": true
        }
      },
      "analyzer": {
        "my_index_analyzer": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": ["lowercase"]
        },
        "my_search_analyzer": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": ["lowercase", "synonyms_filter"]
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "title": {
        "type": "text",
        "analyzer": "my_index_analyzer",
        "search_analyzer": "my_search_analyzer"
      }
    }
  }
}
----
// TESTSETUP
////

[source,console]
----
DELETE _synonyms/my-synonyms-set/test-1
----

[source,console-result]
----
{
  "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"
        ]
      }
    ]
  }
}
----
// TESTRESPONSE[s/1wYFZzq8Sxeu_Jvt9mlbkg/$body.reload_analyzers_details.reload_details.0.reloaded_node_ids.0/]

All analyzers using this synonyms set will be <<synonyms-set-analyzer-reloading,reloaded automatically>> to reflect the rule being deleted.
