[[get-synonym-rule]]
=== Get synonym rule

beta::[]

++++
<titleabbrev>Get synonym rule</titleabbrev>
++++

Retrieves a synonym rule from a synonyms set.

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

`GET _synonyms/<synonyms_set>/<synonym_rule>`

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

Requires the `manage_search_synonyms` cluster privilege.

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

`<synonyms_set>`::
(Required, string)
Synonyms set identifier to retrieve the synonym rule from.

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

[[get-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.

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

The following example retrieves 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"
    },
    {
      "id": "test-3",
      "synonyms": "bye, goodbye"
    },
    {
      "id": "test-2",
      "synonyms": "test => check"
    }
  ]
}
----
// TESTSETUP
////

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

[source,console-result]
----
{
  "id": "test-1",
  "synonyms": "hello, hi"
}
----

