get-enrich-policy.asciidoc 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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,enrich policy>>.
  9. ////
  10. [source,console]
  11. ----
  12. PUT /users
  13. {
  14. "mappings" : {
  15. "properties" : {
  16. "email" : { "type" : "keyword" }
  17. }
  18. }
  19. }
  20. PUT /_enrich/policy/my-policy
  21. {
  22. "match": {
  23. "indices": "users",
  24. "match_field": "email",
  25. "enrich_fields": ["first_name", "last_name", "city", "zip", "state"]
  26. }
  27. }
  28. PUT /_enrich/policy/other-policy
  29. {
  30. "match": {
  31. "indices": "users",
  32. "match_field": "email",
  33. "enrich_fields": ["first_name", "last_name", "city", "zip", "state"]
  34. }
  35. }
  36. ----
  37. ////
  38. [source,console]
  39. --------------------------------------------------
  40. GET /_enrich/policy/my-policy
  41. --------------------------------------------------
  42. // TEST[continued]
  43. [[get-enrich-policy-api-request]]
  44. ==== {api-request-title}
  45. `GET /_enrich/policy/<enrich-policy>`
  46. `GET /_enrich/policy`
  47. [[get-enrich-policy-api-prereqs]]
  48. ==== {api-prereq-title}
  49. include::put-enrich-policy.asciidoc[tag=enrich-policy-api-prereqs]
  50. [[get-enrich-policy-api-path-params]]
  51. ==== {api-path-parms-title}
  52. `<enrich-policy>`::
  53. +
  54. --
  55. (Optional, string)
  56. Comma-separated list of enrich policy names
  57. used to limit the request.
  58. To return information for all enrich policies,
  59. omit this parameter.
  60. --
  61. [[get-enrich-policy-api-example]]
  62. ==== {api-examples-title}
  63. [[get-enrich-policy-api-single-ex]]
  64. ===== Get a single policy
  65. [source,console]
  66. --------------------------------------------------
  67. GET /_enrich/policy/my-policy
  68. --------------------------------------------------
  69. // TEST[continued]
  70. The API returns the following response:
  71. [source,console-result]
  72. --------------------------------------------------
  73. {
  74. "policies": [
  75. {
  76. "config": {
  77. "match": {
  78. "name" : "my-policy",
  79. "indices" : ["users"],
  80. "match_field" : "email",
  81. "enrich_fields" : [
  82. "first_name",
  83. "last_name",
  84. "city",
  85. "zip",
  86. "state"
  87. ]
  88. }
  89. }
  90. }
  91. ]
  92. }
  93. --------------------------------------------------
  94. [[get-enrich-policy-api-commas-ex]]
  95. ===== Get multiple policies
  96. [source,console]
  97. --------------------------------------------------
  98. GET /_enrich/policy/my-policy,other-policy
  99. --------------------------------------------------
  100. // TEST[continued]
  101. The API returns the following response:
  102. [source,console-result]
  103. --------------------------------------------------
  104. {
  105. "policies": [
  106. {
  107. "config": {
  108. "match": {
  109. "name" : "my-policy",
  110. "indices" : ["users"],
  111. "match_field" : "email",
  112. "enrich_fields" : [
  113. "first_name",
  114. "last_name",
  115. "city",
  116. "zip",
  117. "state"
  118. ]
  119. }
  120. }
  121. },
  122. {
  123. "config": {
  124. "match": {
  125. "name" : "other-policy",
  126. "indices" : ["users"],
  127. "match_field" : "email",
  128. "enrich_fields" : [
  129. "first_name",
  130. "last_name",
  131. "city",
  132. "zip",
  133. "state"
  134. ]
  135. }
  136. }
  137. }
  138. ]
  139. }
  140. --------------------------------------------------
  141. [[get-enrich-policy-api-all-ex]]
  142. ===== Get all policies
  143. [source,console]
  144. --------------------------------------------------
  145. GET /_enrich/policy
  146. --------------------------------------------------
  147. // TEST[continued]
  148. The API returns the following response:
  149. [source,console-result]
  150. --------------------------------------------------
  151. {
  152. "policies": [
  153. {
  154. "config": {
  155. "match": {
  156. "name" : "my-policy",
  157. "indices" : ["users"],
  158. "match_field" : "email",
  159. "enrich_fields" : [
  160. "first_name",
  161. "last_name",
  162. "city",
  163. "zip",
  164. "state"
  165. ]
  166. }
  167. }
  168. },
  169. {
  170. "config": {
  171. "match": {
  172. "name" : "other-policy",
  173. "indices" : ["users"],
  174. "match_field" : "email",
  175. "enrich_fields" : [
  176. "first_name",
  177. "last_name",
  178. "city",
  179. "zip",
  180. "state"
  181. ]
  182. }
  183. }
  184. }
  185. ]
  186. }
  187. --------------------------------------------------
  188. ////
  189. [source,console]
  190. --------------------------------------------------
  191. DELETE /_enrich/policy/my-policy
  192. DELETE /_enrich/policy/other-policy
  193. --------------------------------------------------
  194. // TEST[continued]
  195. ////