List query rulesets
editList query rulesets
editReturns information about all stored query rulesets. Summary information on the number of rules per ruleset will be returned, and full details can be returned with the Get query ruleset command.
Request
editGET _query_rules/
Prerequisites
editRequires the manage_search_query_rules
privilege.
Path parameters
edit-
size
- (Optional, integer) Maximum number of results to retrieve.
-
from
- (Optional, integer) The offset from the first result to fetch.
Examples
editThe following example lists all configured query rulesets:
resp = client.query_rules.list_rulesets() print(resp)
const response = await client.transport.request({ method: "GET", path: "/_query_rules", }); console.log(response);
GET _query_rules/
The following example lists the first three query rulesets:
resp = client.query_rules.list_rulesets( from_="0", size="3", ) print(resp)
const response = await client.transport.request({ method: "GET", path: "/_query_rules", querystring: { from: "0", size: "3", }, }); console.log(response);
GET _query_rules/?from=0&size=3
A sample response:
{ "count": 3, "results": [ { "ruleset_id": "ruleset-1", "rule_total_count": 1, "rule_criteria_types_counts": { "exact": 1 }, "rule_type_counts": { "pinned": 1 } }, { "ruleset_id": "ruleset-2", "rule_total_count": 2, "rule_criteria_types_counts": { "exact": 1, "fuzzy": 1 }, "rule_type_counts": { "pinned": 2 } }, { "ruleset_id": "ruleset-3", "rule_total_count": 3, "rule_criteria_types_counts": { "exact": 1, "fuzzy": 2 }, "rule_type_counts": { "pinned": 2, "exclude": 1 } } ] }
The counts in rule_criteria_types_counts
may be larger than the value of rule_total_count
, because a rule may have multiple criteria.