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.
Test query ruleset
editTest query ruleset
editEvaluates match criteria against a query ruleset to identify the rules that would match that criteria.
This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
Request
editPOST _query_rules/<ruleset_id>/_test
Prerequisites
editRequires the manage_search_query_rules
privilege.
Path parameters
edit-
<ruleset_id>
- (Required, string)
Request body
edit-
match_criteria
-
(Required, object) Defines 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.
Response codes
edit-
400
-
The
ruleset_id
ormatch_criteria
were not provided. -
404
(Missing resources) -
No query ruleset matching
ruleset_id
could be found.
Examples
editTo test a ruleset, provide the match criteria that you want to test against:
POST _query_rules/my-ruleset/_test { "match_criteria": { "query_string": "puggles" } }
A sample response:
{ "total_matched_rules": 1, "matched_rules": [ { "ruleset_id": "my-ruleset", "rule_id": "my-rule1" } ] }