This documentation contains work-in-progress information for future Elastic Stack and Cloud releases. Use the version selector to view supported release docs. It also contains some Elastic Cloud serverless information. Check out our serverless docs for more details.
Get enrich policy API
editGet enrich policy API
editReturns 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
Prerequisites
editTo use enrich policies, you must have:
-
read
index privileges for any indices used -
The
enrich_user
built-in role
Path parameters
edit-
<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
editGet a single policy
editresp = 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
editresp = 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
editresp = 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" ] } } } ] }