Skip to content

Commit 1e29219

Browse files
committed
Correct spelling on index plural...
1 parent 89ed402 commit 1e29219

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A library to enable you to safely rotate indexes with no downtime to end users.
66

77
### Why would I use this?
88

9-
In many situations, Elasticsearch is used as an ephemeral datastore used to take structured or relational data, and make it fast to search on that data. Often this is achieved via scheduled jobs that read data from a permanent datastore (such as MySQL or Postgres) and translate it into an Elasticsearch index.
9+
In many situations, Elasticsearch is used as an ephemeral datastore used to take structured or relational data and make it fast to search on that data. Often this is achieved via scheduled jobs that read data from a permanent datastore (such as MySQL or Postgres) and translate it into an Elasticsearch index.
1010

1111
In many cases, rebuilding an index requires a clean slate so that the entire index is rebuilt. How do you do this without interrupting end users searching on that index? The answer is a rotating index.
1212

@@ -51,7 +51,7 @@ $newlyBuiltIndexName = $this->buildIndex($client);
5151
$indexRotator->copyPrimaryIndexToSecondary();
5252
$indexRotator->setPrimaryIndex($newlyBuiltIndexName);
5353
// optionally remove the old index right now
54-
$indexRotator->deleteSecondaryIndexes();
54+
$indexRotator->deleteSecondaryIndices();
5555
```
5656

5757
#### All together
@@ -85,7 +85,7 @@ class MySearchIndex {
8585
$indexRotator->copyPrimaryIndexToSecondary();
8686
$indexRotator->setPrimaryIndex($newlyBuiltIndexName);
8787
// optionally remove the old index right now
88-
$indexRotator->deleteSecondaryIndexes();
88+
$indexRotator->deleteSecondaryIndices();
8989
}
9090

9191
private function buildIndex(\Elasticsearch\Client $client) {

src/IndexRotator.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function copyPrimaryIndexToSecondary($retryCount = 0)
160160
* @param string $olderThan
161161
* @return array
162162
*/
163-
public function getSecondaryIndexes(\DateTime $olderThan = null)
163+
public function getSecondaryIndices(\DateTime $olderThan = null)
164164
{
165165
if ($olderThan === null) {
166166
$olderThan = new \DateTime();
@@ -213,10 +213,10 @@ public function getSecondaryIndexes(\DateTime $olderThan = null)
213213
* @param \DateTime $olderThan
214214
* @return array Results of the bulk operation.
215215
*/
216-
public function deleteSecondaryIndexes(\DateTime $olderThan = null)
216+
public function deleteSecondaryIndices(\DateTime $olderThan = null)
217217
{
218218
$results = [];
219-
foreach ($this->getSecondaryIndexes($olderThan) as $indexToDelete) {
219+
foreach ($this->getSecondaryIndices($olderThan) as $indexToDelete) {
220220
if ($this->engine->indices()->exists(['index' => $indexToDelete])) {
221221
$results[$indexToDelete] = $this->engine->indices()->delete(['index' => $indexToDelete]);
222222
$this->logger->debug('Deleted secondary index.', compact('indexToDelete'));

tests/IndexRotatorTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ public function testCopyPrimaryIndexToSecondary()
9494
* @dataProvider secondaryIndexConditionProvider
9595
*/
9696
public function testGetSecondaryIndices($olderThan, $expectedIndices) {
97-
$results = $this->indexRotator->getSecondaryIndexes($olderThan);
97+
$results = $this->indexRotator->getSecondaryIndices($olderThan);
9898
$this->assertEmpty(array_diff($results, $expectedIndices));
9999
}
100100

101101
/**
102102
* @dataProvider secondaryIndexConditionProvider
103103
*/
104104
public function testDeleteSecondaryIndices($olderThan, $expectedToDelete) {
105-
$results = $this->indexRotator->deleteSecondaryIndexes($olderThan);
105+
$results = $this->indexRotator->deleteSecondaryIndices($olderThan);
106106
$this->assertEmpty(array_diff(array_keys($results), $expectedToDelete));
107107
foreach ($results as $result) {
108108
$this->assertEquals(['acknowledged' => true], $result);

0 commit comments

Comments
 (0)