#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2020/4/23 0023 上午 9:54
# @Author  : hj
# @File    : trade_es.py
# @Software: PyCharm

from db.mod_db import EsBase

class trade_Es:
    def __init__(self, es=None):
        if es is None:
            self.esBase = EsBase()
        else:
            self.esBase = es
    def Get_Data_By_Body(self,companyNames):
        query = {
                "query": {
                    "bool": {
                        "must": [
                            {
                                "term": {
                                    "company_name.raw": companyNames
                                }
                            }
                        ]
                    }
                }
            }
        return self.esBase.select(index='bigdata_ic_gsb_company_op',body=query)