Get filters API

Retrieves filters.

Request

GET _ml/filters/<filter_id>

GET _ml/filters/

Prerequisites

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

Description

You can get a single filter or all filters. For more information, see Machine learning custom rules.

Path parameters

<filter_id>
(Optional, string) Identifier for the filter.

Query parameters

from
(Optional, integer) Skips the specified number of filters.
size
(Optional, integer) Specifies the maximum number of filters to obtain.

Response body

The API returns the following information:

filters

(array) An array of filter resources. A filter resource has the following properties:

filter_id
(string) A string that uniquely identifies the filter.
description
(string) A description of the filter.
items
(array of strings) An array of strings which is the filter item list.

Examples

The following example gets configuration information for the safe_domains filter:

GET _ml/filters/safe_domains

The API returns the following results:

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