获取 enrich 策略 API编辑

返回有关 enrich 策略 的信息。

response = client.enrich.get_policy(
  name: 'my-policy'
)
puts response
GET /_enrich/policy/my-policy

请求编辑

GET /_enrich/policy/<name>

GET /_enrich/policy

GET /_enrich/policy/policy1,policy2

先决条件编辑

要使用 enrich 策略,您必须具有

  • 对使用的任何索引的 read 索引权限
  • enrich_user 内置角色

路径参数编辑

<name>

(可选,字符串)用于限制请求的 enrich 策略名称的逗号分隔列表。

要返回所有 enrich 策略的信息,请省略此参数。

示例编辑

获取单个策略编辑

response = client.enrich.get_policy(
  name: 'my-policy'
)
puts response
GET /_enrich/policy/my-policy

API 返回以下响应

{
  "policies": [
    {
      "config": {
        "match": {
          "name": "my-policy",
          "indices": [ "users" ],
          "match_field": "email",
          "enrich_fields": [
            "first_name",
            "last_name",
            "city",
            "zip",
            "state"
          ]
        }
      }
    }
  ]
}

获取多个策略编辑

response = client.enrich.get_policy(
  name: 'my-policy,other-policy'
)
puts response
GET /_enrich/policy/my-policy,other-policy

API 返回以下响应

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

获取所有策略编辑

response = client.enrich.get_policy
puts response
GET /_enrich/policy

API 返回以下响应

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