Query rules

class elasticsearch.client.QueryRulesClient(client)
Parameters:

client (BaseClient)

delete_rule(*, ruleset_id, rule_id, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes a query rule within a query ruleset.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/delete-query-rule.html

Parameters:
  • ruleset_id (str) – The unique identifier of the query ruleset containing the rule to delete

  • rule_id (str) – The unique identifier of the query rule within the specified ruleset to delete

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

delete_ruleset(*, ruleset_id, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes a query ruleset.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/delete-query-ruleset.html

Parameters:
  • ruleset_id (str) – The unique identifier of the query ruleset to delete

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

get_rule(*, ruleset_id, rule_id, error_trace=None, filter_path=None, human=None, pretty=None)

Returns the details about a query rule within a query ruleset

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/get-query-rule.html

Parameters:
  • ruleset_id (str) – The unique identifier of the query ruleset containing the rule to retrieve

  • rule_id (str) – The unique identifier of the query rule within the specified ruleset to retrieve

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

get_ruleset(*, ruleset_id, error_trace=None, filter_path=None, human=None, pretty=None)

Returns the details about a query ruleset

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/get-query-ruleset.html

Parameters:
  • ruleset_id (str) – The unique identifier of the query ruleset

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

list_rulesets(*, error_trace=None, filter_path=None, from_=None, human=None, pretty=None, size=None)

Returns summarized information about existing query rulesets.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/list-query-rulesets.html

Parameters:
  • from – Starting offset (default: 0)

  • size (int | None) – specifies a max number of results to get

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • from_ (int | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

put_rule(*, ruleset_id, rule_id, actions=None, criteria=None, type=None, error_trace=None, filter_path=None, human=None, pretty=None, priority=None, body=None)

Creates or updates a query rule within a query ruleset.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/put-query-rule.html

Parameters:
  • ruleset_id (str) – The unique identifier of the query ruleset containing the rule to be created or updated

  • rule_id (str) – The unique identifier of the query rule within the specified ruleset to be created or updated

  • actions (Mapping[str, Any] | None)

  • criteria (Mapping[str, Any] | Sequence[Mapping[str, Any]] | None)

  • type (str | Literal['exclude', 'pinned'] | None)

  • priority (int | None)

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

  • body (Dict[str, Any] | None)

Return type:

ObjectApiResponse[Any]

put_ruleset(*, ruleset_id, rules=None, error_trace=None, filter_path=None, human=None, pretty=None, body=None)

Creates or updates a query ruleset.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/put-query-ruleset.html

Parameters:
Return type:

ObjectApiResponse[Any]

test(*, ruleset_id, match_criteria=None, error_trace=None, filter_path=None, human=None, pretty=None, body=None)

Creates or updates a query ruleset.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/test-query-ruleset.html

Parameters:
  • ruleset_id (str) – The unique identifier of the query ruleset to be created or updated

  • match_criteria (Mapping[str, Any] | None)

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

  • body (Dict[str, Any] | None)

Return type:

ObjectApiResponse[Any]