get-synonym-rule.asciidoc 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. [[get-synonym-rule]]
  2. === Get synonym rule
  3. beta::[]
  4. ++++
  5. <titleabbrev>Get synonym rule</titleabbrev>
  6. ++++
  7. Retrieves a synonym rule from a synonyms set.
  8. [[get-synonym-rule-request]]
  9. ==== {api-request-title}
  10. `GET _synonyms/<synonyms_set>/<synonym_rule>`
  11. [[get-synonym-rule-prereqs]]
  12. ==== {api-prereq-title}
  13. Requires the `manage_search_synonyms` cluster privilege.
  14. [[get-synonym-rule-path-params]]
  15. ==== {api-path-parms-title}
  16. `<synonyms_set>`::
  17. (Required, string)
  18. Synonyms set identifier to retrieve the synonym rule from.
  19. `<synonym_rule>`::
  20. (Required, string)
  21. Synonym rule identifier to retrieve.
  22. [[get-synonym-rule-response-codes]]
  23. ==== {api-response-codes-title}
  24. `404` (Missing resources)::
  25. The `synonyms_set` identifier was not found, or the synonym rule specified by `synonym_rule` was not found in the synonyms set.
  26. [[get-synonym-rule-example]]
  27. ==== {api-examples-title}
  28. The following example retrieves an existing synonym rule called `test-1` for the synonyms set `my-synonyms-set`:
  29. ////
  30. [source,console]
  31. ----
  32. PUT _synonyms/my-synonyms-set
  33. {
  34. "synonyms_set": [
  35. {
  36. "id": "test-1",
  37. "synonyms": "hello, hi"
  38. },
  39. {
  40. "id": "test-3",
  41. "synonyms": "bye, goodbye"
  42. },
  43. {
  44. "id": "test-2",
  45. "synonyms": "test => check"
  46. }
  47. ]
  48. }
  49. ----
  50. // TESTSETUP
  51. ////
  52. [source,console]
  53. ----
  54. GET _synonyms/my-synonyms-set/test-1
  55. ----
  56. [source,console-result]
  57. ----
  58. {
  59. "id": "test-1",
  60. "synonyms": "hello, hi"
  61. }
  62. ----