67 lines
1.4 KiB
Plaintext
67 lines
1.4 KiB
Plaintext
// tag::own-deployment[]
|
|
|
|
The following requests create and execute a policy called `clientip_policy`. The
|
|
policy links an IP address to an environment ("Development", "QA", or
|
|
"Production"):
|
|
|
|
[source,console]
|
|
----
|
|
PUT clientips
|
|
{
|
|
"mappings": {
|
|
"properties": {
|
|
"client_ip": {
|
|
"type": "keyword"
|
|
},
|
|
"env": {
|
|
"type": "keyword"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
PUT clientips/_bulk
|
|
{ "index" : {}}
|
|
{ "client_ip": "172.21.0.5", "env": "Development" }
|
|
{ "index" : {}}
|
|
{ "client_ip": "172.21.2.113", "env": "QA" }
|
|
{ "index" : {}}
|
|
{ "client_ip": "172.21.2.162", "env": "QA" }
|
|
{ "index" : {}}
|
|
{ "client_ip": "172.21.3.15", "env": "Production" }
|
|
{ "index" : {}}
|
|
{ "client_ip": "172.21.3.16", "env": "Production" }
|
|
|
|
PUT /_enrich/policy/clientip_policy
|
|
{
|
|
"match": {
|
|
"indices": "clientips",
|
|
"match_field": "client_ip",
|
|
"enrich_fields": ["env"]
|
|
}
|
|
}
|
|
|
|
PUT /_enrich/policy/clientip_policy/_execute?wait_for_completion=false
|
|
----
|
|
// TEST[s/\?wait_for_completion=false//]
|
|
|
|
////
|
|
[source,console]
|
|
----
|
|
DELETE /_enrich/policy/clientip_policy
|
|
----
|
|
// TEST[continued]
|
|
////
|
|
|
|
// end::own-deployment[]
|
|
|
|
|
|
// tag::demo-env[]
|
|
|
|
On the demo environment at https://ela.st/ql/[ela.st/ql],
|
|
an enrich policy called `clientip_policy` has already been created an executed.
|
|
The policy links an IP address to an environment ("Development", "QA", or
|
|
"Production").
|
|
|
|
// end::demo-env[]
|