elasticsearch/docs/reference/synonyms/apis/get-synonyms-set.asciidoc

103 lines
1.9 KiB
Plaintext

[[get-synonyms-set]]
=== Get synonyms set
++++
<titleabbrev>Get synonyms set</titleabbrev>
++++
Retrieves a synonyms set.
[[get-synonyms-set-request]]
==== {api-request-title}
`GET _synonyms/<synonyms_set>`
[[get-synonyms-set-prereqs]]
==== {api-prereq-title}
Requires the `manage_search_synonyms` cluster privilege.
[[get-synonyms-set-path-params]]
==== {api-path-parms-title}
`<synonyms_set>`::
(Required, string)
Synonyms set identifier to retrieve.
[[get-synonyms-set-query-params]]
==== {api-query-parms-title}
`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`.
[[get-synonyms-set-response-codes]]
==== {api-response-codes-title}
`400`::
The `synonyms_set` identifier was not provided.
`404` (Missing resources)::
No synonyms set with the identifier `synonyms_set` was found.
[[get-synonyms-set-example]]
==== {api-examples-title}
The following example retrieves a synonyms set called `my-synonyms-set`:
////
[source,console]
----
PUT _synonyms/my-synonyms-set
{
"synonyms_set": [
{
"id": "test-1",
"synonyms": "hello, hi"
},
{
"id": "test-2",
"synonyms": "bye, goodbye"
},
{
"id": "test-3",
"synonyms": "test => check"
}
]
}
----
// TESTSETUP
////
[source,console]
----
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:
[source,console-result]
----
{
"count": 3,
"synonyms_set": [
{
"id": "test-1",
"synonyms": "hello, hi"
},
{
"id": "test-2",
"synonyms": "bye, goodbye"
},
{
"id": "test-3",
"synonyms": "test => check"
}
]
}
----