From 420a155cb57b7572ec4eb2db94134990e940880f Mon Sep 17 00:00:00 2001 From: Kathleen DeRusso Date: Tue, 5 Dec 2023 10:35:06 -0500 Subject: [PATCH 1/2] [Query Rules] Add some usability clarifications to docs --- docs/reference/query-dsl/rule-query.asciidoc | 1 + .../reference/query-rules/apis/put-query-ruleset.asciidoc | 3 +++ .../search-your-data/search-using-query-rules.asciidoc | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/docs/reference/query-dsl/rule-query.asciidoc b/docs/reference/query-dsl/rule-query.asciidoc index cf79a564f81a3..f92a9e67b5344 100644 --- a/docs/reference/query-dsl/rule-query.asciidoc +++ b/docs/reference/query-dsl/rule-query.asciidoc @@ -10,6 +10,7 @@ preview::[] Applies <> to the query before returning results. This feature is used to promote documents in the manner of a <> based on matching defined rules. If no matching query rules are defined, the "organic" matches for the query are returned. +All matching rules are applied in the order in which they appear in the query ruleset. [NOTE] ==== diff --git a/docs/reference/query-rules/apis/put-query-ruleset.asciidoc b/docs/reference/query-rules/apis/put-query-ruleset.asciidoc index 6805201ce9d7c..0d41496a505da 100644 --- a/docs/reference/query-rules/apis/put-query-ruleset.asciidoc +++ b/docs/reference/query-rules/apis/put-query-ruleset.asciidoc @@ -29,6 +29,9 @@ Requires the `manage_search_query_rules` privilege. `rules`:: (Required, array of objects) The specific rules included in this query ruleset. +There is a limit of 100 rules per ruleset. +This can be increased up to 1000 using the `xpack.applications.rules.max_rules_per_ruleset` cluster setting. + Each rule must have the following information: - `rule_id` (Required, string) A unique identifier for this rule. diff --git a/docs/reference/search/search-your-data/search-using-query-rules.asciidoc b/docs/reference/search/search-your-data/search-using-query-rules.asciidoc index ccd06b6681aad..189a50c140a02 100644 --- a/docs/reference/search/search-your-data/search-using-query-rules.asciidoc +++ b/docs/reference/search/search-your-data/search-using-query-rules.asciidoc @@ -174,6 +174,9 @@ PUT /_query_rules/my-ruleset The API response returns a results of `created` or `updated` depending on whether this was a new or edited ruleset. +NOTE: There is a limit of 100 rules per ruleset. +This can be increased up to 1000 using the `xpack.applications.rules.max_rules_per_ruleset` cluster setting. + [source,console-result] ---- { @@ -217,3 +220,8 @@ GET /my-index-000001/_search This rule query will match against `rule1` in the defined query ruleset, and will convert the organic query into a pinned query with `id1` and `id2` pinned as the top hits. Any other matches from the organic query will be returned below the pinned results. + +It's possible to have multiple rules in a ruleset match a single `rule_query`. In this case, the pinned document are returned in the following order: + +- Where the matching rule appears in the ruleset +- If multiple documents are specified in a single rule, in the order they are specified From dd8d22b64bfe1b8e748ab3834fe297550ec063d4 Mon Sep 17 00:00:00 2001 From: Kathleen DeRusso Date: Tue, 5 Dec 2023 10:42:50 -0500 Subject: [PATCH 2/2] Fix typo --- .../search/search-your-data/search-using-query-rules.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/search/search-your-data/search-using-query-rules.asciidoc b/docs/reference/search/search-your-data/search-using-query-rules.asciidoc index 189a50c140a02..5f61865f8ad67 100644 --- a/docs/reference/search/search-your-data/search-using-query-rules.asciidoc +++ b/docs/reference/search/search-your-data/search-using-query-rules.asciidoc @@ -221,7 +221,7 @@ GET /my-index-000001/_search This rule query will match against `rule1` in the defined query ruleset, and will convert the organic query into a pinned query with `id1` and `id2` pinned as the top hits. Any other matches from the organic query will be returned below the pinned results. -It's possible to have multiple rules in a ruleset match a single `rule_query`. In this case, the pinned document are returned in the following order: +It's possible to have multiple rules in a ruleset match a single `rule_query`. In this case, the pinned documents are returned in the following order: - Where the matching rule appears in the ruleset - If multiple documents are specified in a single rule, in the order they are specified