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)
Delete a query rule. Delete a query rule within a query ruleset. This is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/delete-query-rule.html
- Parameters:
- Return type:
- delete_ruleset(*, ruleset_id, error_trace=None, filter_path=None, human=None, pretty=None)
Delete a query ruleset. Remove a query ruleset and its associated data. This is a destructive action that is not recoverable.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/delete-query-ruleset.html
- get_rule(*, ruleset_id, rule_id, error_trace=None, filter_path=None, human=None, pretty=None)
Get a query rule. Get details about a query rule within a query ruleset.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/get-query-rule.html
- Parameters:
- Return type:
- get_ruleset(*, ruleset_id, error_trace=None, filter_path=None, human=None, pretty=None)
Get a query ruleset. Get details about a query ruleset.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/get-query-ruleset.html
- list_rulesets(*, error_trace=None, filter_path=None, from_=None, human=None, pretty=None, size=None)
Get all query rulesets. Get summarized information about the query rulesets.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/list-query-rulesets.html
- 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)
Create or update a query rule. Create or update a query rule within a query ruleset. IMPORTANT: Due to limitations within pinned queries, you can only pin documents using ids or docs, but cannot use both in single rule. It is advised to use one or the other in query rulesets, to avoid errors. Additionally, pinned queries have a maximum limit of 100 pinned hits. If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/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) – The actions to take when the rule is matched. The format of this action depends on the rule type.
criteria (Mapping[str, Any] | Sequence[Mapping[str, Any]] | None) – The criteria that must be met for the rule to be applied. If multiple criteria are specified for a rule, all criteria must be met for the rule to be applied.
type (str | Literal['exclude', 'pinned'] | None) – The type of rule.
priority (int | None)
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- put_ruleset(*, ruleset_id, rules=None, error_trace=None, filter_path=None, human=None, pretty=None, body=None)
Create or update a query ruleset. There is a limit of 100 rules per ruleset. This limit can be increased by using the xpack.applications.rules.max_rules_per_ruleset cluster setting. IMPORTANT: Due to limitations within pinned queries, you can only select documents using ids or docs, but cannot use both in single rule. It is advised to use one or the other in query rulesets, to avoid errors. Additionally, pinned queries have a maximum limit of 100 pinned hits. If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/put-query-ruleset.html
- Parameters:
- Return type:
- test(*, ruleset_id, match_criteria=None, error_trace=None, filter_path=None, human=None, pretty=None, body=None)
Test a query ruleset. Evaluate match criteria against a query ruleset to identify the rules that would match that criteria.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/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) – The match criteria to apply to rules in the given query ruleset. Match criteria should match the keys defined in the criteria.metadata field of the rule.
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type: