def _geocomplete_index_batch(self, elasticsearch_conn, to_index):
log_msg = 'Indexing documents.'
self._logging(logging.INFO, log_msg)
for ok, info in parallel_bulk(elasticsearch_conn, to_index):
if not ok:
doc_id = info['create']['_id']
doc_type = info['create']['_type']
doc_index = info['create']['_index']
logging_level = logging.ERROR
err_msg = "Couldn't index document: '%s', of type: %s, " \
"under index: %s." % (doc_id, doc_type, doc_index)
self._logging(logging_level, err_msg)
评论列表
文章目录