---
type: api
title: Get a synonym set
description: ## Required authorization
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/operation/operation-synonyms-get-synonym
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/operation/operation-synonyms-get-synonym
products:
  - Elasticsearch
---

# Get a synonym set

Availability: Generally available since 8.10

## Paths

- `GET` `/_synonyms/{id}`

#### Path parameters

- `id` (string) — required
  The synonyms set identifier to retrieve.

## Required authorization

- Cluster privileges: `manage_search_synonyms`

## Authentication

- Api key: `Authorization: <value>`
  Elasticsearch APIs support key-based authentication.
  You must create an API key and use the encoded value in the request header.
  For example:
  
  
  ```
  curl -X GET "${ES_URL}/_cat/indices?v=true" \
    -H "Authorization: ApiKey ${API_KEY}"
  ```
  
  To get API keys, use the `/_security/api_key` APIs.
- Basic: `Authorization: Basic <credentials>`
- Bearer: `Authorization: Bearer <token>`
  Elasticsearch APIs support the use of bearer tokens in the `Authorization` HTTP header to authenticate with the API.
  For examples, refer to [Token-based authentication services](https://www.elastic.co/docs/deploy-manage/users-roles/cluster-or-deployment-auth/token-based-authentication-services)

## Query string parameters

- `from` (number · default: 0) — optional
  The starting offset for synonym rules to retrieve.
- `size` (number · default: 10) — optional
  The max number of synonym rules to retrieve.
- `search_after` (string) — optional
  The synonym rule ID to use as a cursor for pagination.
The next page of results will start after this rule ID.
This parameter cannot be used with `from`.

## Response

`application/json`

- `count` (number)
  The total number of synonyms rules that the synonyms set contains.
- `synonyms_set` (object[])
  Synonym rule details.
  - `id` (string)
    The identifier for the synonym rule.
If you do not specify a synonym rule ID when you create a rule, an identifier is created automatically by Elasticsearch.
  - `synonyms` (string)
    The synonyms that conform the synonym rule in Solr format.
## Code examples

#### Console

```console
GET _synonyms/my-synonyms-set
```

#### JavaScript

```javascript
const response = await client.synonyms.getSynonym({
  id: "my-synonyms-set",
});
```

#### Python

```python
resp = client.synonyms.get_synonym(
    id="my-synonyms-set",
)
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_synonyms/my-synonyms-set" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.synonyms().getSynonym(g -> g
    .id("my-synonyms-set")
);
```

#### C#

```c#
var response = await client.Synonyms.GetSynonymAsync(id: "my-synonyms-set");
```

#### PHP

```php
$resp = $client->synonyms()->getSynonym([
    "id" => "my-synonyms-set",
]);
```

#### Ruby

```ruby
response = client.synonyms.get_synonym(
  id: "my-synonyms-set"
)
```

## Response examples

#### Synonyms get response example1

A successful response from `GET _synonyms/my-synonyms-set`.

```json
{
  "count": 3,
  "synonyms_set": [
    {
      "id": "test-1",
      "synonyms": "hello, hi"
    },
    {
      "id": "test-2",
      "synonyms": "bye, goodbye"
    },
    {
      "id": "test-3",
      "synonyms": "test => check"
    }
  ]
}
```

