2019-09-04 14:11:52 -04:00
|
|
|
[role="xpack"]
|
|
|
|
[testenv="basic"]
|
|
|
|
[[execute-enrich-policy-api]]
|
|
|
|
=== Execute enrich policy API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Execute enrich policy</titleabbrev>
|
|
|
|
++++
|
|
|
|
|
2019-11-19 16:38:13 -05:00
|
|
|
Executes an existing <<enrich-policy,enrich policy>>.
|
2019-09-04 14:11:52 -04:00
|
|
|
|
|
|
|
////
|
|
|
|
|
2019-09-12 10:13:21 -04:00
|
|
|
[source,console]
|
2019-09-04 14:11:52 -04:00
|
|
|
----
|
|
|
|
PUT /users/_doc/1?refresh
|
|
|
|
{
|
2020-07-21 15:49:58 -04:00
|
|
|
"email": "mardy.brown@asciidocsmith.com",
|
|
|
|
"first_name": "Mardy",
|
|
|
|
"last_name": "Brown",
|
|
|
|
"city": "New Orleans",
|
|
|
|
"county": "Orleans",
|
|
|
|
"state": "LA",
|
|
|
|
"zip": 70116,
|
|
|
|
"web": "mardy.asciidocsmith.com"
|
2019-09-04 14:11:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
PUT /_enrich/policy/my-policy
|
|
|
|
{
|
2020-07-21 15:49:58 -04:00
|
|
|
"match": {
|
|
|
|
"indices": "users",
|
|
|
|
"match_field": "email",
|
|
|
|
"enrich_fields": ["first_name", "last_name", "city", "zip", "state"]
|
|
|
|
}
|
2019-09-04 14:11:52 -04:00
|
|
|
}
|
|
|
|
----
|
|
|
|
// TESTSETUP
|
|
|
|
////
|
|
|
|
|
2019-09-12 10:13:21 -04:00
|
|
|
[source,console]
|
2019-09-04 14:11:52 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
PUT /_enrich/policy/my-policy/_execute
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
////
|
2019-09-12 10:13:21 -04:00
|
|
|
[source,console]
|
2019-09-04 14:11:52 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
DELETE /_enrich/policy/my-policy
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
////
|
|
|
|
|
|
|
|
|
|
|
|
[[execute-enrich-policy-api-request]]
|
|
|
|
==== {api-request-title}
|
|
|
|
|
|
|
|
`PUT /_enrich/policy/<enrich-policy>/_execute`
|
|
|
|
|
|
|
|
`POST /_enrich/policy/<enrich-policy>/_execute`
|
|
|
|
|
|
|
|
|
|
|
|
[[execute-enrich-policy-api-prereqs]]
|
|
|
|
==== {api-prereq-title}
|
|
|
|
|
|
|
|
include::put-enrich-policy.asciidoc[tag=enrich-policy-api-prereqs]
|
|
|
|
|
|
|
|
|
|
|
|
[[execute-enrich-policy-api-desc]]
|
|
|
|
==== {api-description-title}
|
|
|
|
|
|
|
|
Use the execute enrich policy API
|
|
|
|
to create the enrich index for an existing enrich policy.
|
|
|
|
|
2019-09-09 08:44:56 -04:00
|
|
|
// tag::execute-enrich-policy-def[]
|
2019-10-09 08:39:11 -04:00
|
|
|
The _enrich index_ contains documents from the policy's source indices.
|
2019-09-04 14:11:52 -04:00
|
|
|
Enrich indices always begin with `.enrich-*`,
|
|
|
|
are read-only,
|
|
|
|
and are <<indices-forcemerge,force merged>>.
|
|
|
|
|
|
|
|
[WARNING]
|
|
|
|
====
|
|
|
|
Enrich indices should be used by the <<enrich-processor,enrich processor>> only.
|
|
|
|
Avoid using enrich indices for other purposes.
|
|
|
|
====
|
2019-09-09 08:44:56 -04:00
|
|
|
// end::execute-enrich-policy-def[]
|
2019-09-04 14:11:52 -04:00
|
|
|
|
2019-09-09 08:44:56 -04:00
|
|
|
// tag::update-enrich-index[]
|
2019-09-04 14:11:52 -04:00
|
|
|
Once created, you cannot update
|
|
|
|
or index documents to an enrich index.
|
|
|
|
Instead, update your source indices
|
2019-11-19 16:38:13 -05:00
|
|
|
and <<execute-enrich-policy-api,execute>> the enrich policy again.
|
2019-09-04 14:11:52 -04:00
|
|
|
This creates a new enrich index from your updated source indices
|
|
|
|
and deletes the previous enrich index.
|
2019-09-09 08:44:56 -04:00
|
|
|
// end::update-enrich-index[]
|
2019-09-04 14:11:52 -04:00
|
|
|
|
|
|
|
Because this API request performs several operations,
|
|
|
|
it may take a while to return a response.
|
|
|
|
|
2019-09-23 13:23:26 -04:00
|
|
|
[[execute-enrich-policy-api-path-params]]
|
2019-09-04 14:11:52 -04:00
|
|
|
==== {api-path-parms-title}
|
|
|
|
|
|
|
|
`<enrich-policy>`::
|
|
|
|
(Required, string)
|
2019-10-15 13:46:55 -04:00
|
|
|
Enrich policy to execute.
|
|
|
|
|
|
|
|
[[execute-enrich-policy-api-request-body]]
|
|
|
|
==== {api-request-body-title}
|
|
|
|
|
|
|
|
`wait_for_completion`::
|
|
|
|
(Required, boolean)
|
|
|
|
If `true`, the request blocks other enrich policy execution requests until
|
|
|
|
complete. Defaults to `true`.
|