Get filters API

Get filters API

New API reference

For the most up-to-date API details, refer to Machine learning anomaly detection APIs.

Retrieves filters.

Request

GET _ml/filters/<filter_id>

GET _ml/filters/

Prerequisites

Requires the manage_ml cluster privilege. This privilege is included in the machine_learning_admin built-in role.

Description

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

Path parameters

<filter_id>

(Optional, string) A string that uniquely identifies a filter.

Query parameters

from

(Optional, integer) Skips the specified number of filters. Defaults to 0.

size

(Optional, integer) Specifies the maximum number of filters to obtain. Defaults to 100.

Response body

The API returns an array of filter resources, which have the following properties:

description

(string) A description of the filter.

filter_id

(string) A string that uniquely identifies a filter.

items

(array of strings) An array of strings which is the filter item list.

Examples

  1. resp = client.ml.get_filters(
  2. filter_id="safe_domains",
  3. )
  4. print(resp)
  1. response = client.ml.get_filters(
  2. filter_id: 'safe_domains'
  3. )
  4. puts response
  1. const response = await client.ml.getFilters({
  2. filter_id: "safe_domains",
  3. });
  4. console.log(response);
  1. GET _ml/filters/safe_domains

The API returns the following results:

  1. {
  2. "count": 1,
  3. "filters": [
  4. {
  5. "filter_id": "safe_domains",
  6. "description": "A list of safe domains",
  7. "items": [
  8. "*.google.com",
  9. "wikipedia.org"
  10. ]
  11. }
  12. ]
  13. }