Get synonym rule

Get synonym rule

New API reference

For the most up-to-date API details, refer to Synonyms APIs.

Retrieves a synonym rule from a synonyms set.

Request

GET _synonyms/<synonyms_set>/<synonym_rule>

Prerequisites

Requires the manage_search_synonyms cluster privilege.

Path parameters

<synonyms_set>

(Required, string) Synonyms set identifier to retrieve the synonym rule from.

<synonym_rule>

(Required, string) Synonym rule identifier to retrieve.

Response codes

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.

Examples

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

  1. resp = client.synonyms.get_synonym_rule(
  2. set_id="my-synonyms-set",
  3. rule_id="test-1",
  4. )
  5. print(resp)
  1. response = client.synonyms.get_synonym_rule(
  2. set_id: 'my-synonyms-set',
  3. rule_id: 'test-1'
  4. )
  5. puts response
  1. const response = await client.synonyms.getSynonymRule({
  2. set_id: "my-synonyms-set",
  3. rule_id: "test-1",
  4. });
  5. console.log(response);
  1. GET _synonyms/my-synonyms-set/test-1
  1. {
  2. "id": "test-1",
  3. "synonyms": "hello, hi"
  4. }