from db.mod_db import EsBase
index = "bigdata_ic_gsb_change_1"

class ChangeMessage:
    def __init__(self, es=None):
        if es is None:
            self.esBase = EsBase()
        else:
            self.esBase = es
    def select_branch(self,factor):
        query = {
            "query":{
                "term":{
                    factor[0]:factor[1]
                }
            },
            "sort": [
                {
                  "change_time": "desc"
                }
              ],
            "size":"10000"
        }
        return self.esBase.select(index=index,body=query)
