command_reindex.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:kinto-elasticsearch 作者: Kinto 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号