[role="xpack"]
[testenv="basic"]
[[put-enrich-policy-api]]
=== Put enrich policy API
++++
Put enrich policy
++++
Creates an enrich policy.
////
[source,console]
----
PUT /users
{
"mappings" : {
"properties" : {
"email" : { "type" : "keyword" }
}
}
}
----
////
[source,console]
----
PUT /_enrich/policy/my-policy
{
"match": {
"indices": "users",
"match_field": "email",
"enrich_fields": ["first_name", "last_name", "city", "zip", "state"]
}
}
----
// TEST[continued]
////
[source,console]
--------------------------------------------------
DELETE /_enrich/policy/my-policy
--------------------------------------------------
// TEST[continued]
////
[[put-enrich-policy-api-request]]
==== {api-request-title}
`PUT /_enrich/policy/`
[[put-enrich-policy-api-prereqs]]
==== {api-prereq-title}
// tag::enrich-policy-api-prereqs[]
If you use {es} {security-features}, you must have:
* `read` index privileges for any indices used
* The `enrich_user` <>
// end::enrich-policy-api-prereqs[]
[[put-enrich-policy-api-desc]]
==== {api-description-title}
Use the put enrich policy API
to create a new <>.
[WARNING]
====
include::../../enrich.asciidoc[tag=update-enrich-policy]
====
[[put-enrich-policy-api-path-params]]
==== {api-path-parms-title}
``::
(Required, string)
include::{docdir}/rest-api/common-parms.asciidoc[tag=enrich-policy]
[[put-enrich-policy-api-request-body]]
==== {api-request-body-title}
``::
+
--
(Required, <> object)
Enrich policy used to match and add the right enrich data to
the right incoming documents.
See <> for object definition and parameters.
--