commits.py 文件源码

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

项目:repoxplorer 作者: morucci 项目源码 文件源码
def update_commits(self, source_it, field='repos'):
        """ Take the sha from each doc and use
        it to reference the doc to update. This method only
        support updating a single field for now. The default one
        is repos because that's the only one to make sense in
        this context.
        """
        def gen(it):
            for source in it:
                d = {}
                d['_index'] = self.index
                d['_type'] = self.dbname
                d['_op_type'] = 'update'
                d['_id'] = source['sha']
                d['_source'] = {'doc': {field: source[field]}}
                yield d
        bulk(self.es, gen(source_it))
        self.es.indices.refresh(index=self.index)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号