Spec-Zone.ru › Elasticsearch 8
›Elasticsearch Guide [8.17] ›REST APIs ›Synonyms APIs

Get synonyms set

New API reference

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

Retrieves a synonyms set.

Request

GET _synonyms/<synonyms_set>

Prerequisites

Requires the manage_search_synonyms cluster privilege.

Path parameters

<synonyms_set>
(Required, string) Synonyms set identifier to retrieve.

Query parameters

from
(Optional, integer) Starting offset for synonyms rules to retrieve. Defaults to 0.
size
(Optional, integer) Specifies the maximum number of synonyms rules to retrieve. Defaults to 10.

Response codes

400
The synonyms_set identifier was not provided.
404 (Missing resources)
No synonyms set with the identifier synonyms_set was found.

Examples

The following example retrieves a synonyms set called my-synonyms-set:

resp = client.synonyms.get_synonym(
    id="my-synonyms-set",
)
print(resp)
response = client.synonyms.get_synonym(
  id: 'my-synonyms-set'
)
puts response
const response = await client.synonyms.getSynonym({
  id: "my-synonyms-set",
});
console.log(response);
GET _synonyms/my-synonyms-set

The synonyms set information returned will include the total number of synonyms rules that the synonyms set contains, and the synonyms rules according to the from and size parameters.

A sample response:

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

© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/get-synonyms-set.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API