Create an enrich policy Generally available; Added in 7.5.0
Creates an enrich policy.
PUT /_enrich/policy/{name}
Console
PUT /_enrich/policy/postal_policy { "geo_match": { "indices": "postal_codes", "match_field": "location", "enrich_fields": [ "location", "postal_code" ] } }
resp = client.enrich.put_policy( name="postal_policy", geo_match={ "indices": "postal_codes", "match_field": "location", "enrich_fields": [ "location", "postal_code" ] }, )
const response = await client.enrich.putPolicy({ name: "postal_policy", geo_match: { indices: "postal_codes", match_field: "location", enrich_fields: ["location", "postal_code"], }, });
response = client.enrich.put_policy( name: "postal_policy", body: { "geo_match": { "indices": "postal_codes", "match_field": "location", "enrich_fields": [ "location", "postal_code" ] } } )
$resp = $client->enrich()->putPolicy([ "name" => "postal_policy", "body" => [ "geo_match" => [ "indices" => "postal_codes", "match_field" => "location", "enrich_fields" => array( "location", "postal_code", ), ], ], ]);
curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"geo_match":{"indices":"postal_codes","match_field":"location","enrich_fields":["location","postal_code"]}}' "$ELASTICSEARCH_URL/_enrich/policy/postal_policy"
client.enrich().putPolicy(p -> p .geoMatch(g -> g .enrichFields(List.of("location","postal_code")) .indices("postal_codes") .matchField("location") ) .name("postal_policy") );
Request example
An example body for a `PUT /_enrich/policy/postal_policy` request.
{ "geo_match": { "indices": "postal_codes", "match_field": "location", "enrich_fields": [ "location", "postal_code" ] } }