elasticsearch_interface.py 文件源码

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

项目:dminer 作者: infosecanon 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号