put-enrich-policy.asciidoc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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,js]
  11. ----
  12. PUT /users
  13. ----
  14. // CONSOLE
  15. ////
  16. [source,js]
  17. ----
  18. PUT /_enrich/policy/my-policy
  19. {
  20. "match": {
  21. "indices": "users",
  22. "match_field": "email",
  23. "enrich_fields": ["first_name", "last_name", "city", "zip", "state"]
  24. }
  25. }
  26. ----
  27. // CONSOLE
  28. // TEST[continued]
  29. ////
  30. [source,js]
  31. --------------------------------------------------
  32. DELETE /_enrich/policy/my-policy
  33. --------------------------------------------------
  34. // CONSOLE
  35. // TEST[continued]
  36. ////
  37. [[put-enrich-policy-api-request]]
  38. ==== {api-request-title}
  39. `PUT /_enrich/policy/<enrich-policy>`
  40. [[put-enrich-policy-api-prereqs]]
  41. ==== {api-prereq-title}
  42. // tag::enrich-policy-api-prereqs[]
  43. If you use {es} {security-features}, you must have:
  44. * `read` index privileges for any indices used
  45. * The `enrich_user` {stack-ov}/built-in-roles.html[built-in role]
  46. // end::enrich-policy-api-prereqs[]
  47. [[put-enrich-policy-api-desc]]
  48. ==== {api-description-title}
  49. Use the put enrich policy API
  50. to create a new enrich policy.
  51. // tag::enrich-policy-def[]
  52. An *enrich policy* is a set of rules the enrich processor uses
  53. to append the appropriate data to incoming documents.
  54. An enrich policy contains:
  55. * The *policy type*,
  56. which determines how the processor enriches incoming documents
  57. * A list of source indices
  58. * The *match field* used to match incoming documents
  59. * *Enrich fields* appended to incoming documents
  60. from matching documents
  61. // end::enrich-policy-def[]
  62. ===== Update an enrich policy
  63. // tag::update-enrich-policy[]
  64. You cannot update an existing enrich policy.
  65. Instead, you can:
  66. . Create and execute a new enrich policy.
  67. . Replace the previous enrich policy
  68. with the new enrich policy
  69. in any in-use enrich processors.
  70. . Use the <<delete-enrich-policy-api, delete enrich policy API>>
  71. to delete the previous enrich policy.
  72. // end::update-enrich-policy[]
  73. [[put-enrich-policy-api-path-params]]
  74. ==== {api-path-parms-title}
  75. `<enrich-policy>`::
  76. (Required, string)
  77. include::{docdir}/rest-api/common-parms.asciidoc[tag=enrich-policy]
  78. [[put-enrich-policy-api-request-body]]
  79. ==== {api-request-body-title}
  80. `<policy-type>`::
  81. +
  82. --
  83. (Required, enrich policy object)
  84. The parameter key is the enrich policy type.
  85. The enrich policy type indicates
  86. how the enrich processor matches incoming documents
  87. to documents in the enrich index.
  88. Valid key values are:
  89. `match`::
  90. Match documents in the enrich index
  91. using a <<query-dsl-term-query, term query>> for the `match_field`.
  92. The parameter value is the enrich policy.
  93. The enrich policy is a set of rules
  94. used to create an <<execute-enrich-policy,enrich index>>.
  95. The enrich processor also uses these rules
  96. to append field data to incoming documents.
  97. Parameters include:
  98. `indices`::
  99. (Required, array of strings)
  100. Source indices used to create the enrich index.
  101. `query`::
  102. (Optional, string)
  103. Query type used to find and select documents in the enrich index.
  104. Valid value is <<query-dsl-match-all-query,`match_all`>> (default).
  105. `match_field`::
  106. (Required, string)
  107. Field used to match incoming documents
  108. to documents in the enrich index.
  109. `enrich_fields`::
  110. (Required, Array of string)
  111. Fields appended to incoming documents
  112. from matching documents in the enrich index.
  113. --