2019-09-04 14:11:52 -04:00
|
|
|
[role="xpack"]
|
|
|
|
[testenv="basic"]
|
|
|
|
[[get-enrich-policy-api]]
|
|
|
|
=== Get enrich policy API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Get enrich policy</titleabbrev>
|
|
|
|
++++
|
|
|
|
|
2019-11-19 16:38:13 -05:00
|
|
|
Returns information about an <<enrich-policy,enrich policy>>.
|
2019-09-04 14:11:52 -04:00
|
|
|
|
|
|
|
////
|
2019-09-12 10:13:21 -04:00
|
|
|
[source,console]
|
2019-09-04 14:11:52 -04:00
|
|
|
----
|
|
|
|
PUT /users
|
2019-10-22 01:38:16 -04:00
|
|
|
{
|
|
|
|
"mappings" : {
|
|
|
|
"properties" : {
|
|
|
|
"email" : { "type" : "keyword" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-09-04 14:11:52 -04:00
|
|
|
|
|
|
|
PUT /_enrich/policy/my-policy
|
|
|
|
{
|
|
|
|
"match": {
|
|
|
|
"indices": "users",
|
|
|
|
"match_field": "email",
|
|
|
|
"enrich_fields": ["first_name", "last_name", "city", "zip", "state"]
|
|
|
|
}
|
|
|
|
}
|
2019-09-10 11:42:28 -04:00
|
|
|
|
|
|
|
PUT /_enrich/policy/other-policy
|
|
|
|
{
|
|
|
|
"match": {
|
|
|
|
"indices": "users",
|
|
|
|
"match_field": "email",
|
|
|
|
"enrich_fields": ["first_name", "last_name", "city", "zip", "state"]
|
|
|
|
}
|
|
|
|
}
|
2019-09-04 14:11:52 -04:00
|
|
|
----
|
|
|
|
////
|
|
|
|
|
2019-09-12 10:13:21 -04:00
|
|
|
[source,console]
|
2019-09-04 14:11:52 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
GET /_enrich/policy/my-policy
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
|
|
|
|
|
|
|
|
[[get-enrich-policy-api-request]]
|
|
|
|
==== {api-request-title}
|
|
|
|
|
|
|
|
`GET /_enrich/policy/<enrich-policy>`
|
|
|
|
|
|
|
|
`GET /_enrich/policy`
|
|
|
|
|
2019-09-10 11:42:28 -04:00
|
|
|
`GET /_enrich/policy1,policy2`
|
|
|
|
|
2019-09-04 14:11:52 -04:00
|
|
|
|
|
|
|
[[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>`::
|
2019-09-18 08:30:22 -04:00
|
|
|
+
|
|
|
|
--
|
2019-09-04 14:11:52 -04:00
|
|
|
(Optional, string)
|
2019-09-18 08:30:22 -04:00
|
|
|
Comma-separated list of enrich policy names
|
|
|
|
used to limit the request.
|
|
|
|
|
|
|
|
To return information for all enrich policies,
|
|
|
|
omit this parameter.
|
|
|
|
--
|
2019-09-04 14:11:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
[[get-enrich-policy-api-example]]
|
|
|
|
==== {api-examples-title}
|
|
|
|
|
|
|
|
|
|
|
|
[[get-enrich-policy-api-single-ex]]
|
|
|
|
===== Get a single policy
|
|
|
|
|
2019-09-12 10:13:21 -04:00
|
|
|
[source,console]
|
2019-09-04 14:11:52 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
GET /_enrich/policy/my-policy
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
|
|
|
|
The API returns the following response:
|
|
|
|
|
2019-09-12 10:13:21 -04:00
|
|
|
[source,console-result]
|
2019-09-04 14:11:52 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"policies": [
|
|
|
|
{
|
Add config namespace in get policy api response (#47162)
Currently the policy config is placed directly in the json object
of the toplevel `policies` array field. For example:
```
{
"policies": [
{
"match": {
"name" : "my-policy",
"indices" : ["users"],
"match_field" : "email",
"enrich_fields" : [
"first_name",
"last_name",
"city",
"zip",
"state"
]
}
}
]
}
```
This change adds a `config` field in each policy json object:
```
{
"policies": [
{
"config": {
"match": {
"name" : "my-policy",
"indices" : ["users"],
"match_field" : "email",
"enrich_fields" : [
"first_name",
"last_name",
"city",
"zip",
"state"
]
}
}
}
]
}
```
This allows us in the future to add other information about policies
in the get policy api response.
The UI will consume this API to build an overview of all policies.
The UI may in the future include additional information about a policy
and the plan is to include that in the get policy api, so that this
information can be gathered in a single api call.
An example of the information that is likely to be added is:
* Last policy execution time
* The status of a policy (executing, executed, unexecuted)
* Information about the last failure if exists
2019-09-30 08:36:53 -04:00
|
|
|
"config": {
|
|
|
|
"match": {
|
|
|
|
"name" : "my-policy",
|
|
|
|
"indices" : ["users"],
|
|
|
|
"match_field" : "email",
|
|
|
|
"enrich_fields" : [
|
|
|
|
"first_name",
|
|
|
|
"last_name",
|
|
|
|
"city",
|
|
|
|
"zip",
|
|
|
|
"state"
|
|
|
|
]
|
|
|
|
}
|
2019-09-04 14:11:52 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
|
2019-09-10 11:42:28 -04:00
|
|
|
[[get-enrich-policy-api-commas-ex]]
|
|
|
|
===== Get multiple policies
|
|
|
|
|
2019-09-30 02:04:18 -04:00
|
|
|
[source,console]
|
2019-09-10 11:42:28 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
GET /_enrich/policy/my-policy,other-policy
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
|
|
|
|
The API returns the following response:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"policies": [
|
|
|
|
{
|
Add config namespace in get policy api response (#47162)
Currently the policy config is placed directly in the json object
of the toplevel `policies` array field. For example:
```
{
"policies": [
{
"match": {
"name" : "my-policy",
"indices" : ["users"],
"match_field" : "email",
"enrich_fields" : [
"first_name",
"last_name",
"city",
"zip",
"state"
]
}
}
]
}
```
This change adds a `config` field in each policy json object:
```
{
"policies": [
{
"config": {
"match": {
"name" : "my-policy",
"indices" : ["users"],
"match_field" : "email",
"enrich_fields" : [
"first_name",
"last_name",
"city",
"zip",
"state"
]
}
}
}
]
}
```
This allows us in the future to add other information about policies
in the get policy api response.
The UI will consume this API to build an overview of all policies.
The UI may in the future include additional information about a policy
and the plan is to include that in the get policy api, so that this
information can be gathered in a single api call.
An example of the information that is likely to be added is:
* Last policy execution time
* The status of a policy (executing, executed, unexecuted)
* Information about the last failure if exists
2019-09-30 08:36:53 -04:00
|
|
|
"config": {
|
|
|
|
"match": {
|
|
|
|
"name" : "my-policy",
|
|
|
|
"indices" : ["users"],
|
|
|
|
"match_field" : "email",
|
|
|
|
"enrich_fields" : [
|
|
|
|
"first_name",
|
|
|
|
"last_name",
|
|
|
|
"city",
|
|
|
|
"zip",
|
|
|
|
"state"
|
|
|
|
]
|
|
|
|
}
|
2019-09-10 11:42:28 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
Add config namespace in get policy api response (#47162)
Currently the policy config is placed directly in the json object
of the toplevel `policies` array field. For example:
```
{
"policies": [
{
"match": {
"name" : "my-policy",
"indices" : ["users"],
"match_field" : "email",
"enrich_fields" : [
"first_name",
"last_name",
"city",
"zip",
"state"
]
}
}
]
}
```
This change adds a `config` field in each policy json object:
```
{
"policies": [
{
"config": {
"match": {
"name" : "my-policy",
"indices" : ["users"],
"match_field" : "email",
"enrich_fields" : [
"first_name",
"last_name",
"city",
"zip",
"state"
]
}
}
}
]
}
```
This allows us in the future to add other information about policies
in the get policy api response.
The UI will consume this API to build an overview of all policies.
The UI may in the future include additional information about a policy
and the plan is to include that in the get policy api, so that this
information can be gathered in a single api call.
An example of the information that is likely to be added is:
* Last policy execution time
* The status of a policy (executing, executed, unexecuted)
* Information about the last failure if exists
2019-09-30 08:36:53 -04:00
|
|
|
"config": {
|
|
|
|
"match": {
|
|
|
|
"name" : "other-policy",
|
|
|
|
"indices" : ["users"],
|
|
|
|
"match_field" : "email",
|
|
|
|
"enrich_fields" : [
|
|
|
|
"first_name",
|
|
|
|
"last_name",
|
|
|
|
"city",
|
|
|
|
"zip",
|
|
|
|
"state"
|
|
|
|
]
|
|
|
|
}
|
2019-09-10 11:42:28 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// TESTRESPONSE
|
|
|
|
|
|
|
|
|
2019-09-04 14:11:52 -04:00
|
|
|
[[get-enrich-policy-api-all-ex]]
|
|
|
|
===== Get all policies
|
|
|
|
|
2019-09-12 10:13:21 -04:00
|
|
|
[source,console]
|
2019-09-04 14:11:52 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
GET /_enrich/policy
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
|
|
|
|
The API returns the following response:
|
|
|
|
|
2019-09-12 10:13:21 -04:00
|
|
|
[source,console-result]
|
2019-09-04 14:11:52 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"policies": [
|
|
|
|
{
|
Add config namespace in get policy api response (#47162)
Currently the policy config is placed directly in the json object
of the toplevel `policies` array field. For example:
```
{
"policies": [
{
"match": {
"name" : "my-policy",
"indices" : ["users"],
"match_field" : "email",
"enrich_fields" : [
"first_name",
"last_name",
"city",
"zip",
"state"
]
}
}
]
}
```
This change adds a `config` field in each policy json object:
```
{
"policies": [
{
"config": {
"match": {
"name" : "my-policy",
"indices" : ["users"],
"match_field" : "email",
"enrich_fields" : [
"first_name",
"last_name",
"city",
"zip",
"state"
]
}
}
}
]
}
```
This allows us in the future to add other information about policies
in the get policy api response.
The UI will consume this API to build an overview of all policies.
The UI may in the future include additional information about a policy
and the plan is to include that in the get policy api, so that this
information can be gathered in a single api call.
An example of the information that is likely to be added is:
* Last policy execution time
* The status of a policy (executing, executed, unexecuted)
* Information about the last failure if exists
2019-09-30 08:36:53 -04:00
|
|
|
"config": {
|
|
|
|
"match": {
|
|
|
|
"name" : "my-policy",
|
|
|
|
"indices" : ["users"],
|
|
|
|
"match_field" : "email",
|
|
|
|
"enrich_fields" : [
|
|
|
|
"first_name",
|
|
|
|
"last_name",
|
|
|
|
"city",
|
|
|
|
"zip",
|
|
|
|
"state"
|
|
|
|
]
|
|
|
|
}
|
2019-09-04 14:11:52 -04:00
|
|
|
}
|
2019-09-10 11:42:28 -04:00
|
|
|
},
|
|
|
|
{
|
Add config namespace in get policy api response (#47162)
Currently the policy config is placed directly in the json object
of the toplevel `policies` array field. For example:
```
{
"policies": [
{
"match": {
"name" : "my-policy",
"indices" : ["users"],
"match_field" : "email",
"enrich_fields" : [
"first_name",
"last_name",
"city",
"zip",
"state"
]
}
}
]
}
```
This change adds a `config` field in each policy json object:
```
{
"policies": [
{
"config": {
"match": {
"name" : "my-policy",
"indices" : ["users"],
"match_field" : "email",
"enrich_fields" : [
"first_name",
"last_name",
"city",
"zip",
"state"
]
}
}
}
]
}
```
This allows us in the future to add other information about policies
in the get policy api response.
The UI will consume this API to build an overview of all policies.
The UI may in the future include additional information about a policy
and the plan is to include that in the get policy api, so that this
information can be gathered in a single api call.
An example of the information that is likely to be added is:
* Last policy execution time
* The status of a policy (executing, executed, unexecuted)
* Information about the last failure if exists
2019-09-30 08:36:53 -04:00
|
|
|
"config": {
|
|
|
|
"match": {
|
|
|
|
"name" : "other-policy",
|
|
|
|
"indices" : ["users"],
|
|
|
|
"match_field" : "email",
|
|
|
|
"enrich_fields" : [
|
|
|
|
"first_name",
|
|
|
|
"last_name",
|
|
|
|
"city",
|
|
|
|
"zip",
|
|
|
|
"state"
|
|
|
|
]
|
|
|
|
}
|
2019-09-10 11:42:28 -04:00
|
|
|
}
|
2019-09-04 14:11:52 -04:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
////
|
2019-09-12 10:13:21 -04:00
|
|
|
[source,console]
|
2019-09-04 14:11:52 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
DELETE /_enrich/policy/my-policy
|
2019-09-10 11:42:28 -04:00
|
|
|
DELETE /_enrich/policy/other-policy
|
2019-09-04 14:11:52 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
////
|