def reindex_records(indexer, storage, bucket_id, collection_id):
total = 0
for records in get_paginated_records(storage, bucket_id, collection_id):
try:
with indexer.bulk() as bulk:
for record in records:
bulk.index_record(bucket_id,
collection_id,
record=record)
print(".", end="")
total += len(bulk.operations)
except elasticsearch.ElasticsearchException:
logger.exception("Failed to index record")
print("\n%s records reindexed." % total)
评论列表
文章目录