Create an enrich policy Generally available; Added in 7.5.0

PUT /_enrich/policy/{name}

Creates an enrich policy.

Path parameters

  • name string Required

    Name of the enrich policy to create or update.

Query parameters

  • master_timeout string

    Period to wait for a connection to the master node.

    Values are -1 or 0.

application/json

Body Required

  • geo_match object Additional properties
    Hide geo_match attributes Show geo_match attributes object
    • enrich_fields string | array[string] Required
    • indices string | array[string] Required
    • match_field string Required

      Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

    • query object

      An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

      External documentation
    • name string
    • elasticsearch_version string
  • match object Additional properties
    Hide match attributes Show match attributes object
    • enrich_fields string | array[string] Required
    • indices string | array[string] Required
    • match_field string Required

      Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

    • query object

      An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

      External documentation
    • name string
    • elasticsearch_version string
  • range object Additional properties
    Hide range attributes Show range attributes object
    • enrich_fields string | array[string] Required
    • indices string | array[string] Required
    • match_field string Required

      Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

    • query object

      An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

      External documentation
    • name string
    • elasticsearch_version string

Responses

  • 200 application/json
    Hide response attribute Show response attribute object
    • acknowledged boolean Required

      For a successful response, this value is always true. On failure, an exception is returned instead.

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" ] } }