获取丰富策略 API

编辑

返回有关丰富策略的信息。

resp = client.enrich.get_policy(
    name="my-policy",
)
print(resp)
response = client.enrich.get_policy(
  name: 'my-policy'
)
puts response
const response = await client.enrich.getPolicy({
  name: "my-policy",
});
console.log(response);
GET /_enrich/policy/my-policy

请求

编辑

GET /_enrich/policy/<name>

GET /_enrich/policy

GET /_enrich/policy/policy1,policy2

先决条件

编辑

要使用丰富策略,您必须拥有

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

路径参数

编辑
<name>

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

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

示例

编辑

获取单个策略

编辑
resp = client.enrich.get_policy(
    name="my-policy",
)
print(resp)
response = client.enrich.get_policy(
  name: 'my-policy'
)
puts response
const response = await client.enrich.getPolicy({
  name: "my-policy",
});
console.log(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"
          ]
        }
      }
    }
  ]
}

获取多个策略

编辑
resp = client.enrich.get_policy(
    name="my-policy,other-policy",
)
print(resp)
response = client.enrich.get_policy(
  name: 'my-policy,other-policy'
)
puts response
const response = await client.enrich.getPolicy({
  name: "my-policy,other-policy",
});
console.log(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"
          ]
        }
      }
    }
  ]
}

获取所有策略

编辑
resp = client.enrich.get_policy()
print(resp)
response = client.enrich.get_policy
puts response
const response = await client.enrich.getPolicy();
console.log(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"
          ]
        }
      }
    }
  ]
}