原英文版地址: https://www.elastic.co/guide/en/elasticsearch/reference/7.7/ml-put-filter.html, 原文档版权归 www.elastic.co 所有
本地英文版地址: ../en/ml-put-filter.html

Create filter APIedit

Instantiates a filter.

Requestedit

PUT _ml/filters/<filter_id>

Prerequisitesedit

  • If the Elasticsearch security features are enabled, you must have manage_ml or manage cluster privileges to use this API. See Security privileges.

Descriptionedit

A filter contains a list of strings. It can be used by one or more jobs. Specifically, filters are referenced in the custom_rules property of detector configuration objects.

Path parametersedit

<filter_id>
(Required, string) A string that uniquely identifies a filter.

Request bodyedit

description
(Optional, string) A description of the filter.
items
(Required, array of strings) The items of the filter. A wildcard * can be used at the beginning or the end of an item. Up to 10000 items are allowed in each filter.

Examplesedit

PUT _ml/filters/safe_domains
{
  "description": "A list of safe domains",
  "items": ["*.google.com", "wikipedia.org"]
}

When the filter is created, you receive the following response:

{
  "filter_id": "safe_domains",
  "description": "A list of safe domains",
  "items": ["*.google.com", "wikipedia.org"]
}