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

refactor reindexing #103

Merged
merged 4 commits into from
Mar 11, 2024
Merged

refactor reindexing #103

merged 4 commits into from
Mar 11, 2024

Conversation

petrjasek
Copy link
Member

it handles reindexing without downtime but with items updated during reindexing showing 2x

it creates a new write index with new mapping, then
reindexes the old index to the new one, and after that
deletes the old index.
@petrjasek petrjasek requested a review from MarkLark86 March 8, 2024 16:41

from bson import ObjectId
from elasticsearch.helpers import bulk, reindex
from elasticsearch.helpers import bulk, reindex # noqa: F401
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find any usage of reindex in this module. Is it used somewhere else that imports this module?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep it's imported in superdesk-core, will remove it from there but will keep it for now to avoid a breaking change

print("refresh", index)
es.indices.refresh(index)

def _async_reindex(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although es.reindex execution here is async, this function is still sync as it waits for the task to complete before returning to the callee. Therefor using async in the function name may be misleading (especially when we venture down the async path).

@petrjasek petrjasek merged commit cc925b4 into elastic7 Mar 11, 2024
10 checks passed
@petrjasek petrjasek deleted the reindex-refactoring branch March 11, 2024 11:25
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.

2 participants