From 18e75b4b290a2bda841ed6086c0367882f3c8696 Mon Sep 17 00:00:00 2001 From: Graham Herceg Date: Tue, 23 Apr 2024 17:08:16 -0400 Subject: [PATCH] Only set if not already set --- corehq/apps/es/client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/corehq/apps/es/client.py b/corehq/apps/es/client.py index e6f6922114c7..8b162b32f2ac 100644 --- a/corehq/apps/es/client.py +++ b/corehq/apps/es/client.py @@ -649,7 +649,8 @@ def _search(self, query, **kw): if ES_QUERY_PREFERENCE.enabled(domain): # Use domain as key to route to a consistent set of shards.kwargs # See https://www.elastic.co/guide/en/elasticsearch/reference/5.6/search-request-preference.html - kw['preference'] = domain + if 'preference' not in kw: + kw['preference'] = domain with metrics_histogram_timer( 'commcare.elasticsearch.search.timing',