Skip to content

[Bug] Duplicate Indices (even vs odd) - not cleaned up on reindex #382

Description

@cancan101

Followup to #381, we are ending up with "duplicated" indices where both the even and odd versions continue to exist:

    {
      "health": "green",
      "status": "open",
      "index": "pimcore_data-object_product-even",
      "uuid": "XUv3-r7iQ3uNVPAfaPVAug",
      "pri": "1",
      "rep": "0",
      "docs.count": "17284",
      "docs.deleted": "0",
      "store.size": "35.6mb",
      "pri.store.size": "35.6mb"
    },
    {
      "health": "green",
      "status": "open",
      "index": "pimcore_data-object_product-odd",
      "uuid": "kPLlKMchQZOc0PdNKErV7A",
      "pri": "1",
      "rep": "0",
      "docs.count": "11709",
      "docs.deleted": "66",
      "store.size": "29.9mb",
      "pri.store.size": "29.9mb"
    },

based on my read here:

private function switchIndexAliasAndCleanup(string $aliasName, string $oldIndexName, string $newIndexName): void
{
$params['body'] = [
'actions' => [
[
'remove' => [
'index' => $aliasName . '*',
'alias' => $aliasName,
],
],
[
'add' => [
'index' => $newIndexName,
'alias' => $aliasName,
],
],
],
];
$result = $this->client->updateIndexAliases($params);
if (!$result['acknowledged']) {
throw new SwitchIndexAliasException('Switching Alias failed for ' . $newIndexName);
}
$this->deleteIndex($oldIndexName);
}

the old index should be deleted when swapping.

Metadata

Metadata

Type

No type

Fields

Affected capability

None yet

Platform Version

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions