Skip to content

Commit

Permalink
remove concepts index, reindex each time
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongundel committed Feb 7, 2025
1 parent af5d900 commit 394c3e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arches/app/search/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ def create_snapshot(self, repository, snapshot=None, **kwargs):
delta = dt - epoch_time
snapshot = "{}_{}".format(settings.APP_NAME, int(delta.total_seconds()))

# all indices will be included in the snapshot except concepts - which needs to be
# built from scratch because there is no timestamping for concepts
indices = self.get_index_names()
indices.remove(self._add_prefix(CONCEPTS_INDEX))

return self.es.snapshot.create(
repository=repository,
Expand Down Expand Up @@ -113,7 +116,9 @@ def get_snapshot(self, repository_name, snapshot_name, **kwargs):
)

def restore_status(self):
index_statuses = self.es.indices.recovery(index=self.get_index_names())
indices = self.get_index_names()
indices.remove(self._add_prefix(CONCEPTS_INDEX))
index_statuses = self.es.indices.recovery(index=indices)
for key in index_statuses.keys():
for shard in index_statuses[key]["shards"]:
if shard["stage"] != "DONE":
Expand Down
4 changes: 4 additions & 0 deletions arches/management/commands/es.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,10 @@ def restore_snapshot(self, repository_name=None, snapshot_name=None, options=Non
.create()
.get_snapshot(repository_name, snapshot_name)
)
prepare_concepts_index(create=True)
index_database_util.index_concepts(
batch_size=options["batch_size"],
)
index_database_util.index_resources_by_time(
start_time=snapshot_response["snapshots"][0]["start_time"],
batch_size=options["batch_size"],
Expand Down

0 comments on commit 394c3e6

Please sign in to comment.