#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2020/4/22 0022 下午 5:47
# @Author  : hj
# @File    : tf_member_es.py
# @Software: PyCharm
from db.mod_db import EsBase

class tf_member_Es:
    def __init__(self, es=None):
        if es is None:
            self.esBase = EsBase()
        else:
            self.esBase = es
    def Get_Data_By_Body_1(self,index_name,company_name):
        query = {"query": {"match": {"companyName": company_name}}}
        return self.esBase.select(index=index_name,body=query)

    def Get_Data_By_Body_2(self,index_name,match_field, field_cotent):
        query = {"query": {"match": {match_field: field_cotent}}}
        return self.esBase.select(index=index_name,body=query)