Get enrich policy API
Returns information about an enrich policy.
resp = client.enrich.get_policy(
name="my-policy",
)
print(resp) response = client.enrich.get_policy( name: 'my-policy' ) puts response
const response = await client.enrich.getPolicy({
name: "my-policy",
});
console.log(response); GET /_enrich/policy/my-policy
Request
GET /_enrich/policy/<name>
GET /_enrich/policy
GET /_enrich/policy/policy1,policy2
Prerequisites
To use enrich policies, you must have:
-
readindex privileges for any indices used - The
enrich_userbuilt-in role
Path parameters
-
<name> -
(Optional, string) Comma-separated list of enrich policy names used to limit the request.
To return information for all enrich policies, omit this parameter.
Examples
Get a single policy
resp = client.enrich.get_policy(
name="my-policy",
)
print(resp) response = client.enrich.get_policy( name: 'my-policy' ) puts response
const response = await client.enrich.getPolicy({
name: "my-policy",
});
console.log(response); GET /_enrich/policy/my-policy
The API returns the following response:
{
"policies": [
{
"config": {
"match": {
"name": "my-policy",
"indices": [ "users" ],
"match_field": "email",
"enrich_fields": [
"first_name",
"last_name",
"city",
"zip",
"state"
]
}
}
}
]
} Get multiple policies
resp = client.enrich.get_policy(
name="my-policy,other-policy",
)
print(resp) response = client.enrich.get_policy( name: 'my-policy,other-policy' ) puts response
const response = await client.enrich.getPolicy({
name: "my-policy,other-policy",
});
console.log(response); GET /_enrich/policy/my-policy,other-policy
The API returns the following response:
{
"policies": [
{
"config": {
"match": {
"name": "my-policy",
"indices": [ "users" ],
"match_field": "email",
"enrich_fields": [
"first_name",
"last_name",
"city",
"zip",
"state"
]
}
}
},
{
"config": {
"match": {
"name": "other-policy",
"indices": [ "users" ],
"match_field": "email",
"enrich_fields": [
"first_name",
"last_name",
"city",
"zip",
"state"
]
}
}
}
]
} Get all policies
resp = client.enrich.get_policy() print(resp)
response = client.enrich.get_policy puts response
const response = await client.enrich.getPolicy(); console.log(response);
GET /_enrich/policy
The API returns the following response:
{
"policies": [
{
"config": {
"match": {
"name": "my-policy",
"indices": [ "users" ],
"match_field": "email",
"enrich_fields": [
"first_name",
"last_name",
"city",
"zip",
"state"
]
}
}
},
{
"config": {
"match": {
"name": "other-policy",
"indices": [ "users" ],
"match_field": "email",
"enrich_fields": [
"first_name",
"last_name",
"city",
"zip",
"state"
]
}
}
}
]
}
© 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/get-enrich-policy-api.html