elasticsearch/docs/reference/synonyms/apis/list-synonyms-sets.asciidoc
Kathleen DeRusso a2dc45bc02
[Synonyms] Mark Synonyms as GA (#103223)
* Remove beta from synonyms docs and json definitions

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2023-12-14 14:53:43 -05:00

105 lines
1.7 KiB
Text

[[list-synonyms-sets]]
=== List synonyms sets
++++
<titleabbrev>List synonyms sets</titleabbrev>
++++
Retrieves a summary of all defined synonyms sets.
This API allows to retrieve the total number of synonyms sets defined.
For each synonyms set, its identifier and the total number of defined synonym rules is returned.
[[list-synonyms-sets-request]]
==== {api-request-title}
`GET _synonyms`
[[list-synonyms-sets-prereqs]]
==== {api-prereq-title}
Requires the `manage_search_synonyms` cluster privilege.
[[list-synonyms-sets-query-params]]
==== {api-query-parms-title}
`from`::
(Optional, integer) Starting offset for synonyms sets to retrieve. Defaults to `0`.
`size`::
(Optional, integer) Specifies the maximum number of synonyms sets to retrieve. Defaults to `10`.
[[list-synonyms-sets-example]]
==== {api-examples-title}
The following example retrieves all defined synonyms sets:
////
[source,console]
----
PUT _synonyms/my-synonyms-set
{
"synonyms_set": [
{
"synonyms": "hello, hi"
},
{
"synonyms": "other, another"
},
{
"synonyms": "bye, goodbye"
}
]
}
PUT _synonyms/ecommerce-synonyms
{
"synonyms_set": [
{
"synonyms": "pants, trousers"
},
{
"synonyms": "dress, frock"
}
]
}
PUT _synonyms/new-ecommerce-synonyms
{
"synonyms_set": [
{
"synonyms": "tie, bowtie"
}
]
}
----
// TESTSETUP
////
[source,console]
----
GET _synonyms
----
A sample response:
[source,console-result]
----
{
"count": 3,
"results": [
{
"synonyms_set": "ecommerce-synonyms",
"count": 2
},
{
"synonyms_set": "my-synonyms-set",
"count": 3
},
{
"synonyms_set": "new-ecommerce-synonyms",
"count": 1
}
]
}
----