Skip to content

Commit

Permalink
Merge pull request #3846 from 10up/fix/issue-3823
Browse files Browse the repository at this point in the history
Make sure the mapping exists before trying to change it
  • Loading branch information
felipeelia authored Feb 28, 2024
2 parents a5f423a + fc26aa4 commit 64fb22c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion includes/classes/Feature/Search/Synonyms.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,12 @@ public function update_synonyms() {
function( $success, $index ) {
$filter = $this->get_synonym_filter();
$mapping = Elasticsearch::factory()->get_mapping( $index );
$filters = $mapping[ $index ]['settings']['index']['analysis']['analyzer']['default_search']['filter'];

if ( empty( $mapping ) || empty( $mapping[ $index ] ) ) {
return false;
}

$filters = (array) $mapping[ $index ]['settings']['index']['analysis']['analyzer']['default_search']['filter'];

/*
* Due to limitations in Elasticsearch, we can't remove the filter and analyzer
Expand Down

0 comments on commit 64fb22c

Please sign in to comment.