[role="xpack"] [testenv="basic"] [[get-enrich-policy-api]] === Get enrich policy API ++++ Get enrich policy ++++ Returns information about an enrich policy. //// [source,console] ---- PUT /users PUT /_enrich/policy/my-policy { "match": { "indices": "users", "match_field": "email", "enrich_fields": ["first_name", "last_name", "city", "zip", "state"] } } ---- //// [source,console] -------------------------------------------------- GET /_enrich/policy/my-policy -------------------------------------------------- // TEST[continued] [[get-enrich-policy-api-request]] ==== {api-request-title} `GET /_enrich/policy/` `GET /_enrich/policy` [[get-enrich-policy-api-prereqs]] ==== {api-prereq-title} include::put-enrich-policy.asciidoc[tag=enrich-policy-api-prereqs] [[get-enrich-policy-api-path-params]] ==== {api-path-parms-title} ``:: (Optional, string) include::{docdir}/rest-api/common-parms.asciidoc[tag=enrich-policy] [[get-enrich-policy-api-example]] ==== {api-examples-title} [[get-enrich-policy-api-single-ex]] ===== Get a single policy [source,console] -------------------------------------------------- GET /_enrich/policy/my-policy -------------------------------------------------- // TEST[continued] The API returns the following response: [source,console-result] -------------------------------------------------- { "policies": [ { "match": { "name" : "my-policy", "indices" : ["users"], "match_field" : "email", "enrich_fields" : [ "first_name", "last_name", "city", "zip", "state" ] } } ] } -------------------------------------------------- [[get-enrich-policy-api-all-ex]] ===== Get all policies [source,console] -------------------------------------------------- GET /_enrich/policy -------------------------------------------------- // TEST[continued] The API returns the following response: [source,console-result] -------------------------------------------------- { "policies": [ { "match": { "name" : "my-policy", "indices" : ["users"], "match_field" : "email", "enrich_fields" : [ "first_name", "last_name", "city", "zip", "state" ] } } ] } -------------------------------------------------- //// [source,console] -------------------------------------------------- DELETE /_enrich/policy/my-policy -------------------------------------------------- // TEST[continued] ////