Skip to content

Commit

Permalink
Merge pull request #25 from novaway/allow-removal-of-old-indexes
Browse files Browse the repository at this point in the history
Allow removal of old indexes when rebuilding mapping
  • Loading branch information
napley authored Aug 30, 2023
2 parents 23db09a + 2acef44 commit e758197
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Provider/IndexProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function rebuildIndex($markAsLive = true, $removeOldIndexes = true): Inde
/**
* Update fields mapping
*/
public function rebuildMapping(bool $waitForCompletion = true): Index
public function rebuildMapping(bool $waitForCompletion = true, bool $removeOldIndexes = false): Index
{
$realName = sprintf('%s_rebuild_mapping_%s', $this->name, date('YmdHis'));
$index = $this->getIndexByName($realName);
Expand All @@ -93,7 +93,7 @@ public function rebuildMapping(bool $waitForCompletion = true): Index
]
]);

return $this->markAsLive($index, false) ? $index : $this->getIndex();
return $this->markAsLive($index, $removeOldIndexes) ? $index : $this->getIndex();
}

/**
Expand Down

0 comments on commit e758197

Please sign in to comment.