Create filter APIedit

Instantiates a filter.


PUT _ml/filters/<filter_id>


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


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

(Required, string) Identifier for the filter.

Request bodyedit

(Optional, string) A description of the filter.
(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.


The following example creates the safe_domains filter:

PUT _ml/filters/safe_domains
  "description": "A list of safe domains",
  "items": ["*", ""]

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

  "filter_id": "safe_domains",
  "description": "A list of safe domains",
  "items": ["*", ""]