This documentation contains work-in-progress information for future Elastic Stack and Cloud releases. Use the version selector to view supported release docs. It also contains some Elastic Cloud serverless information. Check out our serverless docs for more details.
Get filters API
editGet filters API
editRetrieves filters.
Prerequisites
editRequires the manage_ml
cluster privilege. This privilege is included in the
machine_learning_admin
built-in role.
Description
editYou can get a single filter or all filters. For more information, see Custom rules.
Path parameters
edit-
<filter_id>
- (Optional, string) A string that uniquely identifies a filter.
Query parameters
edit-
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
editThe 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
editresp = client.ml.get_filters( filter_id="safe_domains", ) print(resp)
response = client.ml.get_filters( filter_id: 'safe_domains' ) puts response
const response = await client.ml.getFilters({ filter_id: "safe_domains", }); console.log(response);
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" ] } ] }