from elasticsearch import Elasticsearch

import json

class E:

    def __init__(self):

        self.esnode = Elasticsearch(hosts="192.168.2.10")


    def totalIndex(self):

        # 전체 인덱스 조회

        pass

    def searchCnt(self):

        c = self.esnode.count(index="tb_frip_tourareacode", doc_type="doc")

        print (c["count"])

        # docs = self.esnode.search(index="tb_frip_tourareacode",

        #                    doc_type="doc",

        #                    body={

        #                        "query": {

        #                            "match_all":{

        #

        #                            }

        #                        }

        #                    })

        #

        # print (json.dumps(docs, indent=2, ensure_ascii=False))

def main():

    node = E()

    node.searchCnt()


if __name__ == "__main__":

    main()

'ELK > elasticsearch' 카테고리의 다른 글

java elasticsearch ( 주말에 정리할 코드 )  (0) 2019.03.08
python + elasticsearch  (0) 2019.02.21
python + elasticsearch  (0) 2019.02.16
python + elasticsearch + 조회/삽입/생성  (0) 2019.02.03
search java api  (0) 2019.01.29