---
type: api
title: Get all synonym sets
description: Get a summary of all defined synonym sets.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v9/operation/operation-synonyms-get-synonyms-sets
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v9/operation/operation-synonyms-get-synonyms-sets
products:
  - Elasticsearch
---

# Get all synonym sets

Availability: Generally available since 8.10

## Paths

- `GET` `/_synonyms`

## Description

Get a summary of all defined synonym sets.

## 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 synonyms sets to retrieve.
- `size` (number · default: 10) — optional
  The maximum number of synonyms sets to retrieve.

## Response

`application/json`

- `count` (number)
  The total number of synonyms sets defined.
- `results` (object[])
  The identifier and total number of defined synonym rules for each synonyms set.
  - `synonyms_set` (string)
    Synonyms set identifier
  - `count` (number)
    Number of synonym rules that the synonym set contains
## Code examples

#### Console

```console
GET _synonyms
```

#### JavaScript

```javascript
const response = await client.synonyms.getSynonymsSets();
```

#### Python

```python
resp = client.synonyms.get_synonyms_sets()
```

#### curl

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

#### Java

```java
client.synonyms().getSynonymsSets(g -> g);
```

#### C#

```c#
var response = await client.Synonyms.GetSynonymsSetsAsync();
```

#### PHP

```php
$resp = $client->synonyms()->getSynonymsSets();
```

#### Ruby

```ruby
response = client.synonyms.get_synonyms_sets
```

## Response examples

#### Synonyms sets get response example1

A successful response from `GET _synonyms`.

```json
{
  "count": 3,
  "results": [
    {
      "synonyms_set": "ecommerce-synonyms",
      "count": 2
    },
    {
      "synonyms_set": "my-synonyms-set",
      "count": 3
    },
    {
      "synonyms_set": "new-ecommerce-synonyms",
      "count": 1
    }
  ]
}
```

