get-enrich-policy.asciidoc 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[get-enrich-policy-api]]
  4. === Get enrich policy API
  5. ++++
  6. <titleabbrev>Get enrich policy</titleabbrev>
  7. ++++
  8. Returns information about an enrich policy.
  9. ////
  10. [source,console]
  11. ----
  12. PUT /users
  13. PUT /_enrich/policy/my-policy
  14. {
  15. "match": {
  16. "indices": "users",
  17. "match_field": "email",
  18. "enrich_fields": ["first_name", "last_name", "city", "zip", "state"]
  19. }
  20. }
  21. PUT /_enrich/policy/other-policy
  22. {
  23. "match": {
  24. "indices": "users",
  25. "match_field": "email",
  26. "enrich_fields": ["first_name", "last_name", "city", "zip", "state"]
  27. }
  28. }
  29. ----
  30. ////
  31. [source,console]
  32. --------------------------------------------------
  33. GET /_enrich/policy/my-policy
  34. --------------------------------------------------
  35. // TEST[continued]
  36. [[get-enrich-policy-api-request]]
  37. ==== {api-request-title}
  38. `GET /_enrich/policy/<enrich-policy>`
  39. `GET /_enrich/policy`
  40. `GET /_enrich/policy1,policy2`
  41. [[get-enrich-policy-api-prereqs]]
  42. ==== {api-prereq-title}
  43. include::put-enrich-policy.asciidoc[tag=enrich-policy-api-prereqs]
  44. [[get-enrich-policy-api-path-params]]
  45. ==== {api-path-parms-title}
  46. `<enrich-policy>`::
  47. (Optional, string)
  48. include::{docdir}/rest-api/common-parms.asciidoc[tag=enrich-policy]
  49. [[get-enrich-policy-api-example]]
  50. ==== {api-examples-title}
  51. [[get-enrich-policy-api-single-ex]]
  52. ===== Get a single policy
  53. [source,console]
  54. --------------------------------------------------
  55. GET /_enrich/policy/my-policy
  56. --------------------------------------------------
  57. // TEST[continued]
  58. The API returns the following response:
  59. [source,console-result]
  60. --------------------------------------------------
  61. {
  62. "policies": [
  63. {
  64. "match": {
  65. "name" : "my-policy",
  66. "indices" : ["users"],
  67. "match_field" : "email",
  68. "enrich_fields" : [
  69. "first_name",
  70. "last_name",
  71. "city",
  72. "zip",
  73. "state"
  74. ]
  75. }
  76. }
  77. ]
  78. }
  79. --------------------------------------------------
  80. [[get-enrich-policy-api-commas-ex]]
  81. ===== Get multiple policies
  82. [source,console]
  83. --------------------------------------------------
  84. GET /_enrich/policy/my-policy,other-policy
  85. --------------------------------------------------
  86. // TEST[continued]
  87. The API returns the following response:
  88. [source,console-result]
  89. --------------------------------------------------
  90. {
  91. "policies": [
  92. {
  93. "match": {
  94. "name" : "my-policy",
  95. "indices" : ["users"],
  96. "match_field" : "email",
  97. "enrich_fields" : [
  98. "first_name",
  99. "last_name",
  100. "city",
  101. "zip",
  102. "state"
  103. ]
  104. }
  105. },
  106. {
  107. "match": {
  108. "name" : "other-policy",
  109. "indices" : ["users"],
  110. "match_field" : "email",
  111. "enrich_fields" : [
  112. "first_name",
  113. "last_name",
  114. "city",
  115. "zip",
  116. "state"
  117. ]
  118. }
  119. }
  120. ]
  121. }
  122. --------------------------------------------------
  123. [[get-enrich-policy-api-all-ex]]
  124. ===== Get all policies
  125. [source,console]
  126. --------------------------------------------------
  127. GET /_enrich/policy
  128. --------------------------------------------------
  129. // TEST[continued]
  130. The API returns the following response:
  131. [source,console-result]
  132. --------------------------------------------------
  133. {
  134. "policies": [
  135. {
  136. "match": {
  137. "name" : "my-policy",
  138. "indices" : ["users"],
  139. "match_field" : "email",
  140. "enrich_fields" : [
  141. "first_name",
  142. "last_name",
  143. "city",
  144. "zip",
  145. "state"
  146. ]
  147. }
  148. },
  149. {
  150. "match": {
  151. "name" : "other-policy",
  152. "indices" : ["users"],
  153. "match_field" : "email",
  154. "enrich_fields" : [
  155. "first_name",
  156. "last_name",
  157. "city",
  158. "zip",
  159. "state"
  160. ]
  161. }
  162. }
  163. ]
  164. }
  165. --------------------------------------------------
  166. ////
  167. [source,console]
  168. --------------------------------------------------
  169. DELETE /_enrich/policy/my-policy
  170. DELETE /_enrich/policy/other-policy
  171. --------------------------------------------------
  172. // TEST[continued]
  173. ////