From 2574e5acf8ddb314fad81d1b59f406aa64460b98 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Thu, 10 Feb 2022 17:47:02 -0800 Subject: [PATCH 1/4] Document that awareness attributes override custom preferences When selecting replicas in a search, the coordinating node prefers nodes with the same shard allocation awareness attributes. If the search contains a custom preference string, then it will be ignored in favor of selecting a node with the same attributes. In 8.0, allocation awareness attributes no longer influence search replica selection. So although this is a bug, we do not intend to fix it in 7.x or 6.x. Instead, we document the behavior as a 'warning' and mention a system property that can be used to disable the behavior. --- .../search/search-your-data/search-shard-routing.asciidoc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/reference/search/search-your-data/search-shard-routing.asciidoc b/docs/reference/search/search-your-data/search-shard-routing.asciidoc index b0286986df7fe..3c84f1890d10b 100644 --- a/docs/reference/search/search-your-data/search-shard-routing.asciidoc +++ b/docs/reference/search/search-your-data/search-shard-routing.asciidoc @@ -88,6 +88,12 @@ GET /my-index-000001/_search?preference=my-custom-shard-string ---- // TEST[setup:my_index] +WARNING: If a node has <> +attributes, it will ignore custom `preference` values and instead prefer shards +with the same awareness attribute values. You can disable routing based on +awareness attributes by enabling the `es.search.ignore_awareness_attributes` +system property on every node in the cluster. + NOTE: If the cluster state or selected shards change, the same `preference` string may not route searches to the same shards in the same order. This can occur for a number of reasons, including shard relocations and shard failures. A From 4917de6630d9db829cb026cf479441554e513525 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Thu, 10 Feb 2022 18:10:39 -0800 Subject: [PATCH 2/4] Improve the description --- .../search-your-data/search-shard-routing.asciidoc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/reference/search/search-your-data/search-shard-routing.asciidoc b/docs/reference/search/search-your-data/search-shard-routing.asciidoc index 3c84f1890d10b..cfc45ed7cd153 100644 --- a/docs/reference/search/search-your-data/search-shard-routing.asciidoc +++ b/docs/reference/search/search-your-data/search-shard-routing.asciidoc @@ -89,10 +89,12 @@ GET /my-index-000001/_search?preference=my-custom-shard-string // TEST[setup:my_index] WARNING: If a node has <> -attributes, it will ignore custom `preference` values and instead prefer shards -with the same awareness attribute values. You can disable routing based on -awareness attributes by enabling the `es.search.ignore_awareness_attributes` -system property on every node in the cluster. +attributes, then it will prefer shards with the same awareness attribute values. +So even if a search specifies the same custom `preference` values, different +coordinating nodes may route it differently because of their awareness +attributes. You can disable routing based on awareness attributes entirely by +enabling the `es.search.ignore_awareness_attributes` system property on every +node in the cluster. NOTE: If the cluster state or selected shards change, the same `preference` string may not route searches to the same shards in the same order. This can From 8ecf1de3ecdab94a986221592c33c94416ff4c7e Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Fri, 11 Feb 2022 14:16:18 -0800 Subject: [PATCH 3/4] Improve wording Co-authored-by: James Rodewig --- .../search-your-data/search-shard-routing.asciidoc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/reference/search/search-your-data/search-shard-routing.asciidoc b/docs/reference/search/search-your-data/search-shard-routing.asciidoc index cfc45ed7cd153..56ebe8bcb9d62 100644 --- a/docs/reference/search/search-your-data/search-shard-routing.asciidoc +++ b/docs/reference/search/search-your-data/search-shard-routing.asciidoc @@ -90,11 +90,11 @@ GET /my-index-000001/_search?preference=my-custom-shard-string WARNING: If a node has <> attributes, then it will prefer shards with the same awareness attribute values. -So even if a search specifies the same custom `preference` values, different -coordinating nodes may route it differently because of their awareness -attributes. You can disable routing based on awareness attributes entirely by -enabling the `es.search.ignore_awareness_attributes` system property on every -node in the cluster. +Because of these attributes, different coordinating nodes may route same search +differently, even if the searches use the same custom `preference` values. To +disable routing based on awareness attributes, set the +`es.search.ignore_awareness_attributes` system property to `true` in the +<> of every node in the cluster. NOTE: If the cluster state or selected shards change, the same `preference` string may not route searches to the same shards in the same order. This can From 6a107329e394d5f032cbaeec52e9880db1b08eab Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Fri, 11 Feb 2022 14:25:53 -0800 Subject: [PATCH 4/4] Fix typo --- .../search/search-your-data/search-shard-routing.asciidoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/reference/search/search-your-data/search-shard-routing.asciidoc b/docs/reference/search/search-your-data/search-shard-routing.asciidoc index 56ebe8bcb9d62..47df3e1dfcaae 100644 --- a/docs/reference/search/search-your-data/search-shard-routing.asciidoc +++ b/docs/reference/search/search-your-data/search-shard-routing.asciidoc @@ -90,9 +90,9 @@ GET /my-index-000001/_search?preference=my-custom-shard-string WARNING: If a node has <> attributes, then it will prefer shards with the same awareness attribute values. -Because of these attributes, different coordinating nodes may route same search -differently, even if the searches use the same custom `preference` values. To -disable routing based on awareness attributes, set the +Because of these attributes, different coordinating nodes may route the same +search differently, even if the searches use the same custom `preference` +values. To disable routing based on awareness attributes, set the `es.search.ignore_awareness_attributes` system property to `true` in the <> of every node in the cluster.