Get a query rule
- GET /_query_rules/{ruleset_id}/_rule/{rule_id}
Get details about a query rule within a query ruleset.
- Cluster privileges:
manage_search_query_rules
Path Parameters
-
ruleset_idstring Idrequired -
The unique identifier of the query ruleset containing the rule to retrieve
-
rule_idstring Idrequired -
The unique identifier of the query rule within the specified ruleset to retrieve
Response
-
rule_idstring Idrequired -
A unique identifier for the rule.
-
typeQueryRuleTyperequired -
The type of rule.
pinnedwill identify and pin specific documents to the top of search results.excludewill exclude specific documents from search results. -
Values:
pinnedexclude -
criteriaoneOfrequired -
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.
-
typeQueryRuleCriteriaTyperequired -
The type of criteria. The following criteria types are supported:
always: Matches all queries, regardless of input.contains: Matches that contain this value anywhere in the field meet the criteria defined by the rule. Only applicable for string values.exact: Only exact matches meet the criteria defined by the rule. Applicable for string or numerical values.fuzzy: Exact matches or matches within the allowed Levenshtein Edit Distance meet the criteria defined by the rule. Only applicable for string values.gt: Matches with a value greater than this value meet the criteria defined by the rule. Only applicable for numerical values.gte: Matches with a value greater than or equal to this value meet the criteria defined by the rule. Only applicable for numerical values.lt: Matches with a value less than this value meet the criteria defined by the rule. Only applicable for numerical values.lte: Matches with a value less than or equal to this value meet the criteria defined by the rule. Only applicable for numerical values.prefix: Matches that start with this value meet the criteria defined by the rule. Only applicable for string values.suffix: Matches that end with this value meet the criteria defined by the rule. Only applicable for string values.
-
Values:
globalexactfuzzyprefixsuffixcontainsltltegtgtealways -
metadatastring -
The metadata field to match against. This metadata will be used to match against
match_criteriasent in the rule. It is required for all criteria types exceptalways. -
valuesobject -
The values to match against the
metadatafield. Only one value must match for the criteria to be met. It is required for all criteria types exceptalways. -
actionsQueryRuleActionsrequired -
The actions to take when the rule is matched. The format of this action depends on the rule type.
-
idsstring Id -
The unique document IDs of the documents to apply the rule to. Only one of
idsordocsmay be specified and at least one must be specified. -
docsPinnedDoc -
The documents to apply the rule to. Only one of
idsordocsmay be specified and at least one must be specified. There is a maximum value of 100 documents in a rule. You can specify the following attributes for each document:_index: The index of the document to pin._id: The unique document ID.
-
prioritynumber