From 33c4736b34650c55b4e58237575a42229906e0d3 Mon Sep 17 00:00:00 2001 From: Kathleen DeRusso Date: Thu, 17 Aug 2023 10:50:44 -0400 Subject: [PATCH 1/3] Query rules docs clarification --- .../search-using-query-rules.asciidoc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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 8d6cea338b246..f354fb9202c83 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 @@ -95,7 +95,9 @@ The actions to take when the rule matches a query: * `ids` will pin the specified <>s. * `docs` will pin the specified documents in the specified indices. -Use `ids` when searching over a single index, and `docs` when searching over multiple indices. See <> for details. +Use `ids` when searching over a single index, and `docs` when searching over multiple indices. +`ids` and `docs` cannot be combined in the same query. +See <> for details. [discrete] [[add-query-rules]] @@ -105,8 +107,8 @@ You can add query rules using the <> call. This adds a rulese The following command will create a query ruleset called `my-ruleset` with two pinned document rules: -* The first rule will generate a <> pinning the <>s `id1` and `id2` when the `user.query` metadata value is a fuzzy match to either `puggles` or `pugs` _and_ the user's location is in the US. -* The second rule will generate a <> pinning the <> of `id3` specifically from the `my-index-000001` index and `id4` from the `my-index-000002` index when the `user.query` metadata value matches `beagles`. +* The first rule will generate a <> pinning the <>s `id1` and `id2` when the `user_query` metadata value is a fuzzy match to either `puggles` or `pugs` _and_ the user's location is in the US. +* The second rule will generate a <> pinning the <> of `id3` specifically from the `my-index-000001` index and `id4` from the `my-index-000002` index when the `user_query` metadata value contains `beagles`. //// [source,console] @@ -132,7 +134,7 @@ PUT /_query_rules/my-ruleset }, { "type": "exact", - "metadata": "user.country", + "metadata": "user_country", "values": [ "us" ] } ], @@ -204,7 +206,7 @@ GET /my-index-000001/_search }, "match_criteria": { "query_string": "puggles", - "user.country": "us" + "user_country": "us" }, "ruleset_id": "my-ruleset" } @@ -214,4 +216,4 @@ GET /my-index-000001/_search // TEST[continued] 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 `user.query` query specified in the organic query will be returned below the pinned results. +Any other matches from the organic query will be returned below the pinned results. From 4e98378a54f7336321ba52400dbf01c24f65bdb6 Mon Sep 17 00:00:00 2001 From: Kathleen DeRusso Date: Thu, 17 Aug 2023 11:10:58 -0400 Subject: [PATCH 2/3] Update docs/reference/search/search-your-data/search-using-query-rules.asciidoc --- .../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 f354fb9202c83..52a69ce190994 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 @@ -107,7 +107,7 @@ You can add query rules using the <> call. This adds a rulese The following command will create a query ruleset called `my-ruleset` with two pinned document rules: -* The first rule will generate a <> pinning the <>s `id1` and `id2` when the `user_query` metadata value is a fuzzy match to either `puggles` or `pugs` _and_ the user's location is in the US. +* The first rule will generate a <> pinning the <>s `id1` and `id2` when the `query_string` metadata value is a fuzzy match to either `puggles` or `pugs` _and_ the user's location is in the US. * The second rule will generate a <> pinning the <> of `id3` specifically from the `my-index-000001` index and `id4` from the `my-index-000002` index when the `user_query` metadata value contains `beagles`. //// From 2dac364d4e7e66a8c3754b72895d255d1630d320 Mon Sep 17 00:00:00 2001 From: Kathleen DeRusso Date: Thu, 17 Aug 2023 11:11:25 -0400 Subject: [PATCH 3/3] Update docs/reference/search/search-your-data/search-using-query-rules.asciidoc --- .../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 52a69ce190994..6234fdb0481dd 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 @@ -108,7 +108,7 @@ You can add query rules using the <> call. This adds a rulese The following command will create a query ruleset called `my-ruleset` with two pinned document rules: * The first rule will generate a <> pinning the <>s `id1` and `id2` when the `query_string` metadata value is a fuzzy match to either `puggles` or `pugs` _and_ the user's location is in the US. -* The second rule will generate a <> pinning the <> of `id3` specifically from the `my-index-000001` index and `id4` from the `my-index-000002` index when the `user_query` metadata value contains `beagles`. +* The second rule will generate a <> pinning the <> of `id3` specifically from the `my-index-000001` index and `id4` from the `my-index-000002` index when the `query_string` metadata value contains `beagles`. //// [source,console]