def setup(self, config):
"""
Establish connection to Elasticsearch cluster and start periodic commit.
:param config: Configuration object.
:type config: ``dict``
"""
self.config = config
self.context_size = config.get(helper.CONTEXT_SIZE, 120)
self.elastic_bulk = queue.Queue()
self.elastic = self.config[helper.INJECTOR].get_elasticsearch()
self.helper = self.config[helper.INJECTOR].get_elasticsearch_helper()
self.create_mapping()
thread = threading.Thread(target=self._commit, args=())
thread.daemon = True
thread.start()
self.thread = thread
评论列表
文章目录