Get query rule
editGet query rule
editRetrieves information about an individual query rule within a query ruleset.
Request
editGET _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
orrule_id
, or both. -
404
(Missing resources) -
Either no query ruleset matching
ruleset_id
could be found, or no rule matchingrule_id
could be found within that ruleset.
Examples
editThe following example gets the query rule with ID my-rule1
from the ruleset named my-ruleset
:
resp = client.query_rules.get_rule( ruleset_id="my-ruleset", rule_id="my-rule1", ) print(resp)
const response = await client.transport.request({ method: "GET", path: "/_query_rules/my-ruleset/_rule/my-rule1", }); console.log(response);
GET _query_rules/my-ruleset/_rule/my-rule1
A sample response:
{ "rule_id": "my-rule1", "type": "pinned", "criteria": [ { "type": "contains", "metadata": "query_string", "values": [ "pugs", "puggles" ] } ], "actions": { "ids": [ "id1", "id2" ] } }