put-enrich-policy.asciidoc 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[put-enrich-policy-api]]
  4. === Create or update enrich policy API
  5. ++++
  6. <titleabbrev>Create or update enrich policy</titleabbrev>
  7. ++++
  8. Creates or updates an enrich policy.
  9. ////
  10. [source,console]
  11. ----
  12. PUT /users
  13. {
  14. "mappings": {
  15. "properties": {
  16. "email": { "type": "keyword" }
  17. }
  18. }
  19. }
  20. ----
  21. ////
  22. [source,console]
  23. ----
  24. PUT /_enrich/policy/my-policy
  25. {
  26. "match": {
  27. "indices": "users",
  28. "match_field": "email",
  29. "enrich_fields": ["first_name", "last_name", "city", "zip", "state"]
  30. }
  31. }
  32. ----
  33. // TEST[continued]
  34. ////
  35. [source,console]
  36. --------------------------------------------------
  37. DELETE /_enrich/policy/my-policy
  38. --------------------------------------------------
  39. // TEST[continued]
  40. ////
  41. [[put-enrich-policy-api-request]]
  42. ==== {api-request-title}
  43. `PUT /_enrich/policy/<enrich-policy>`
  44. [[put-enrich-policy-api-prereqs]]
  45. ==== {api-prereq-title}
  46. // tag::enrich-policy-api-prereqs[]
  47. If you use {es} {security-features}, you must have:
  48. * `read` index privileges for any indices used
  49. * The `enrich_user` <<built-in-roles,built-in role>>
  50. // end::enrich-policy-api-prereqs[]
  51. [[put-enrich-policy-api-desc]]
  52. ==== {api-description-title}
  53. Use the create or update enrich policy API to create a new
  54. <<enrich-policy,enrich policy>>.
  55. [WARNING]
  56. ====
  57. include::../../enrich.asciidoc[tag=update-enrich-policy]
  58. ====
  59. [[put-enrich-policy-api-path-params]]
  60. ==== {api-path-parms-title}
  61. `<enrich-policy>`::
  62. (Required, string)
  63. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=enrich-policy]
  64. [[put-enrich-policy-api-request-body]]
  65. ==== {api-request-body-title}
  66. `<policy-type>`::
  67. +
  68. --
  69. (Required, <<enrich-policy-definition,enrich policy>> object)
  70. Enrich policy used to match and add the right enrich data to
  71. the right incoming documents.
  72. See <<enrich-policy-definition>> for object definition and parameters.
  73. --