Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix index name mapper getting pure index name frome alias #91

Merged
merged 2 commits into from Nov 10, 2021
Merged

Fix index name mapper getting pure index name frome alias #91

merged 2 commits into from Nov 10, 2021

Conversation

kennywick
Copy link
Contributor

  • getPureIndexName now properly deals with prefixed aliases

  • add Tests for getPureIndexName

  • add function getMappedIndices to get a list of valid indices

* getPureIndexName now properly deals with prefixed aliases

* add Tests for getPureIndexName

* add function getMappedIndices to get a list of valid indices
@kennywick kennywick marked this pull request as ready for review November 10, 2021 11:38
@damienalexandre
Copy link
Member

damienalexandre commented Nov 10, 2021

Thanks a lot for your contribution!

If I understand your change correctly, the idea is to support indices that don't have a date in their name? Is that because the indices are not created via Elastically?

@kennywick
Copy link
Contributor Author

If I understand your change correctly, the idea is to support indices that don't have a date in their name? Is that because the indices are not created via Elastically?

In part yes (that's what we're doing in our integration tests), but also to support getting an index by its alias. Let's take an example of an index todo with prefix foo

$index = $client->getIndex('todo'); 

//This would be 'foo_todo'
$index->getName();

//Then we want to migrate the index
$indexBuilder->migrate($index);

So in the IndexBuilder::migrate() function

        //This currently returns 'foo_todo' instead of 'todo'
        $pureIndexName = $this->indexNameMapper->getPureIndexName($currentIndex->getName());

        //This is now passed the prefixed Index name instead of the pure index name
        $newIndex = $this->createIndex($pureIndexName);

This then expects a mapping file that is named foo_todo_mapping.yaml instead of the existing todo_mapping.yaml

@damienalexandre damienalexandre merged commit 15bb413 into jolicode:master Nov 10, 2021
@damienalexandre
Copy link
Member

Thanks a lot @kennywick 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants