123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- [role="xpack"]
- [testenv="basic"]
- [[get-enrich-policy-api]]
- === Get enrich policy API
- ++++
- <titleabbrev>Get enrich policy</titleabbrev>
- ++++
- Returns information about an <<enrich-policy,enrich policy>>.
- ////
- [source,console]
- ----
- PUT /users
- {
- "mappings" : {
- "properties" : {
- "email" : { "type" : "keyword" }
- }
- }
- }
- PUT /_enrich/policy/my-policy
- {
- "match": {
- "indices": "users",
- "match_field": "email",
- "enrich_fields": ["first_name", "last_name", "city", "zip", "state"]
- }
- }
- PUT /_enrich/policy/other-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/<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}
- `<enrich-policy>`::
- +
- --
- (Optional, string)
- Comma-separated list of enrich policy names
- used to limit the request.
- To return information for all enrich policies,
- omit this parameter.
- --
- [[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": [
- {
- "config": {
- "match": {
- "name" : "my-policy",
- "indices" : ["users"],
- "match_field" : "email",
- "enrich_fields" : [
- "first_name",
- "last_name",
- "city",
- "zip",
- "state"
- ]
- }
- }
- }
- ]
- }
- --------------------------------------------------
- [[get-enrich-policy-api-commas-ex]]
- ===== Get multiple policies
- [source,console]
- --------------------------------------------------
- GET /_enrich/policy/my-policy,other-policy
- --------------------------------------------------
- // TEST[continued]
- The API returns the following response:
- [source,console-result]
- --------------------------------------------------
- {
- "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-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": [
- {
- "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"
- ]
- }
- }
- }
- ]
- }
- --------------------------------------------------
- ////
- [source,console]
- --------------------------------------------------
- DELETE /_enrich/policy/my-policy
- DELETE /_enrich/policy/other-policy
- --------------------------------------------------
- // TEST[continued]
- ////
|