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)
评论列表
文章目录