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.
Delete query rule
editDelete query rule
editRemoves an individual query rule within an existing query ruleset. This is a destructive action that is only recoverable by re-adding the same rule via the create or update query rule API.
Request
editDELETE _query_rules/<ruleset_id>/_rule/<rule_id>
Prerequisites
editRequires the manage_search_query_rules
privilege.
Path parameters
edit-
<ruleset_id>
- (Required, string)
-
<rule_id>
- (Required, string)
Response codes
edit-
400
-
Missing
ruleset_id
,rule_id
, or both. -
404
(Missing resources) -
No query ruleset matching
ruleset_id
could be found, or else no rule matchingrule_id
was found in that ruleset.
Examples
editThe following example deletes the query rule with ID my-rule1
from the query ruleset named my-ruleset
:
resp = client.query_rules.delete_rule( ruleset_id="my-ruleset", rule_id="my-rule1", ) print(resp)
const response = await client.transport.request({ method: "DELETE", path: "/_query_rules/my-ruleset/_rule/my-rule1", }); console.log(response);
DELETE _query_rules/my-ruleset/_rule/my-rule1