from db.mod_db import EsBase
index = "bigdata_ic_gsb_company_op"
import datetime,time,os,sys

class CompanyEs:
    def __init__(self, es=None):
        if es is None:
            self.esBase = EsBase()
        else:
            self.esBase = es
    def select_baise(self,company_name):
        query = {"query": {"bool": {"must": {"term": {"company_name.raw": company_name}}}}}
        return self.esBase.select(index=index,body=query)

    def select_company_body(self):
        query = {"query": {"bool": {"must": []}}, "size": 9000, }
        return query

    def select_company(self,query):
        print(query)
        return self.esBase.select(index=index, body=query)
