Skip to content

Commit

Permalink
Don’t close the ES index before updating settings (#4858)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
WPprodigy authored Sep 12, 2023
1 parent 787f7c2 commit 41d9212
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion search/includes/classes/class-health.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down
2 changes: 1 addition & 1 deletion tests/search/includes/classes/test-class-health.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down

0 comments on commit 41d9212

Please sign in to comment.