-
Notifications
You must be signed in to change notification settings - Fork 16
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
Feature/4016 anon import aliases #2433
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great improvement, thanks @philipkcl - just a couple of changes suggested before merge.
@@ -964,6 +966,25 @@ def refresh(): | |||
return ES.indices.refresh() | |||
|
|||
|
|||
def find_indexes_by_prefix(index_prefix) -> list[str]: | |||
data = ES.indices.get(f'{index_prefix}*') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be good to enforce the separator here (if not index_prefix.endswith('-') ...
) because here is where a missing separator could match a whole lot more indexes than we indend. E.g. if you supply doaj
as the index prefix you'll delete indexes doajstatic-article etc. That won't happen unless the comment in settings.py to include the separator is ignored.
Perhaps we should just ensure the setting always ends with -
instead. Either way, not a blocker for release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not recommend it.
It will fail the first time import. The first time import meaning when the the index name still calling doaj-account
instead of doaj-account-20111212
, which mean it will help to migrate if the environment still using old index name doaj-account
.
Moreover, prefix search by index_type
and the script will show which index will be removed, it should be safe enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added some condition check to avoid future index like doaj-account_abcde
anon import aliases
briefly describe the PR here
This PR...
Developer Checklist
Developers should review and confirm each of these items before requesting review
constants
ormessages
filesdates
)url_for
not hard-codeddevelop
Reviewer Checklist
Reviewers should review and confirm each of these items before approval
If there are multiple reviewers, this section should be duplicated for each reviewer
constants
ormessages
filesdates
)url_for
not hard-codeddevelop
Testing
List user test scripts that need to be run
List any non-unit test scripts that need to be run by reviewers
Deployment
What deployment considerations are there? (delete any sections you don't need)
Configuration changes
What configuration changes are included in this PR, and do we need to set specific values for production
Scripts
What scripts need to be run from the PR (e.g. if this is a report generating feature), and when (once, regularly, etc).
Migrations
What migrations need to be run to deploy this
Monitoring
What additional monitoring is required of the application as a result of this feature
New Infrastructure
What new infrastructure does this PR require (e.g. new services that need to run on the back-end).
Continuous Integration
What CI changes are required for this