Execute enrich policy API
Executes an existing enrich policy.
resp = client.enrich.execute_policy(
name="my-policy",
wait_for_completion=False,
)
print(resp) response = client.enrich.execute_policy( name: 'my-policy', wait_for_completion: false ) puts response
const response = await client.enrich.executePolicy({
name: "my-policy",
wait_for_completion: "false",
});
console.log(response); PUT /_enrich/policy/my-policy/_execute?wait_for_completion=false
Request
PUT /_enrich/policy/<enrich-policy>/_execute
POST /_enrich/policy/<enrich-policy>/_execute
Prerequisites
To use enrich policies, you must have:
-
readindex privileges for any indices used - The
enrich_userbuilt-in role
Description
Use the execute enrich policy API to create the enrich index for an existing enrich policy.
The enrich index contains documents from the policy’s source indices. Enrich indices always begin with .enrich-*, are read-only, and are force merged.
Enrich indices should only be used by the enrich processor or the ES|QL ENRICH command. Avoid using enrich indices for other purposes.
Once created, you cannot update or index documents to an enrich index. Instead, update your source indices and execute the enrich policy again. This creates a new enrich index from your updated source indices. The previous enrich index will deleted with a delayed maintenance job. By default this is done every 15 minutes.
By default, this API is synchronous: It returns when a policy has been executed. Because executing a policy performs several operations, it may take a while to return a response, especially when the source indices are large. This can lead to timeouts. To prevent timeouts, set the wait_for_completion parameter to false. This runs the request asynchronously in the background, and returns a task ID. You can use the task ID to manage the request with the task management API.
Path parameters
-
<enrich-policy> - (Required, string) Enrich policy to execute.
Query parameters
-
wait_for_completion - (Optional, Boolean) If
true, the request blocks until execution is complete. Iffalse, the request returns immediately and execution runs asynchronously in the background. Defaults totrue.
© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/execute-enrich-policy-api.html