From 0e070ada69ce076d36126acfc94f11f0e9d1b218 Mon Sep 17 00:00:00 2001 From: Caleb Burks Date: Tue, 12 Sep 2023 16:36:12 -0500 Subject: [PATCH 1/2] =?UTF-8?q?Don=E2=80=99t=20close=20the=20ES=20index=20?= =?UTF-8?q?before=20updating=20settings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The only settings we auto-fix are dynamic settings, and we don’t need to close the index first before changing those. Closing/opening an index appears to cause quite a bit of stress on the clusters. --- search/includes/classes/class-health.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/search/includes/classes/class-health.php b/search/includes/classes/class-health.php index 1b60b06051..07e67ca9db 100644 --- a/search/includes/classes/class-health.php +++ b/search/includes/classes/class-health.php @@ -1128,7 +1128,7 @@ public function heal_index_settings_for_indexable( \ElasticPress\Indexable $inde $desired_settings_to_heal = self::limit_index_settings_to_keys( $desired_settings, self::INDEX_SETTINGS_HEALTH_AUTO_HEAL_KEYS ); $index_name = $indexable->get_index_name(); if ( method_exists( '\Automattic\VIP\Search\Search', 'should_load_new_ep' ) && \Automattic\VIP\Search\Search::should_load_new_ep() ) { - $result = $this->elasticsearch->update_index_settings( $index_name, $desired_settings_to_heal, true ); + $result = $this->elasticsearch->update_index_settings( $index_name, $desired_settings_to_heal, false ); } else { $result = $indexable->update_index_settings( $desired_settings_to_heal ); } From 3fcd4eb96513d403943ca0c135247bae675ec223 Mon Sep 17 00:00:00 2001 From: Caleb Burks Date: Tue, 12 Sep 2023 16:47:53 -0500 Subject: [PATCH 2/2] fix tests --- tests/search/includes/classes/test-class-health.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/search/includes/classes/test-class-health.php b/tests/search/includes/classes/test-class-health.php index 9f465b536f..0e1d00f9da 100644 --- a/tests/search/includes/classes/test-class-health.php +++ b/tests/search/includes/classes/test-class-health.php @@ -1182,7 +1182,7 @@ public function test_heal_index_settings_for_indexable( $desired_settings, $opti $health->elasticsearch->expects( $this->once() ) ->method( 'update_index_settings' ) - ->with( $index_name, $expected_updated_settings, true ); + ->with( $index_name, $expected_updated_settings, false ); $result = $health->heal_index_settings_for_indexable( $mocked_indexable, $options );