put-enrich-policy.asciidoc 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[put-enrich-policy-api]]
  4. === Put enrich policy API
  5. ++++
  6. <titleabbrev>Put enrich policy</titleabbrev>
  7. ++++
  8. Creates 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 put enrich policy API
  54. to create a new <<enrich-policy,enrich policy>>.
  55. // tag::update-enrich-policy[]
  56. [WARNING]
  57. ====
  58. Once created, you can't update or change an enrich policy.
  59. Instead, you can:
  60. . Create and <<execute-enrich-policy-api,execute>> a new enrich policy.
  61. . Replace the previous enrich policy
  62. with the new enrich policy
  63. in any in-use enrich processors.
  64. . Use the <<delete-enrich-policy-api, delete enrich policy>> API
  65. to delete the previous enrich policy.
  66. ====
  67. // end::update-enrich-policy[]
  68. [[put-enrich-policy-api-path-params]]
  69. ==== {api-path-parms-title}
  70. `<enrich-policy>`::
  71. (Required, string)
  72. include::{docdir}/rest-api/common-parms.asciidoc[tag=enrich-policy]
  73. [[put-enrich-policy-api-request-body]]
  74. ==== {api-request-body-title}
  75. `<policy-type>`::
  76. +
  77. --
  78. (Required, <<enrich-policy-definition,enrich policy>> object)
  79. Enrich policy used to match and add the right enrich data to
  80. the right incoming documents.
  81. See <<enrich-policy-definition>> for object definition and parameters.
  82. --