Language/python

python elk

세모데 2017. 6. 6. 02:10

python에서 검색을 위해 elasticsearch 모듈 설치/사용

(elk 서버는 미리 설치해서 구성)



1. elk 모듈 설치

   pip install pyelasticsearch



2. elk 모듈 사용


   from pyelasticsearch import ElasticSearch

   from pyelasticsearch.exception import IndexAlreadyExistsError



   o_es = ElasticSearch('http://localhost:9200/')


   try:

o_es.create_index('test')

   except IndexAlreadyExistsError, e:

pass