def create(self, *args, **kwargs):
"""
The create method allows for documents passed to be elasticsearch handler
directly.
"""
# date = kwargs.get("date", None)
# parser = kwargs.get('parser', 'default')
# doctype = kwargs.get('type', 'default')
# document = kwargs.get('document', {})
#
# if date:
# # Index document into an index based on index_date field
# options = {
# "index": "dminer-%s-%s" % (parser, date),
# "doc_type": doctype,
# "body": document
# }
# else:
# options = {
# "index": "dminer-%s" % parser,
# "doc_type": doctype,
# "body": document
# }
while True:
try:
value = self.es.index(*args, **kwargs)
except ConnectionTimeout:
print "Connection Timeout"
continue
break
return value
评论列表
文章目录