get-enrich-policy.asciidoc 5.2 KB

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