M. Z. Liu

28 papers Journal 27Unranked 1
YearRankTypeTitle / Venue / Authors
2019 J jnl
Appl. Math. Comput.
Wei Zhang, Xunbo Yin, M. H. Song, M. Z. Liu
2018 J jnl
J. Comput. Appl. Math.
Wei Zhang, M. H. Song, M. Z. Liu
2018 J jnl
Int. J. Comput. Math.
Wei Zhang, M. H. Song, M. Z. Liu
2017 J jnl
Int. J. Comput. Math.
M. H. Song, H. Z. Yang, M. Z. Liu
2017 J jnl
J. Comput. Appl. Math.
Y. L. Lu, M. H. Song, M. Z. Liu
2015 J jnl
J. Comput. Appl. Math.
Xianwei Liu, M. Z. Liu
2015 J jnl
Appl. Math. Comput.
G. L. Zhang, Minghui Song, M. Z. Liu
2015 J jnl
J. Comput. Appl. Math.
G. L. Zhang, M. H. Song, M. Z. Liu
2014 J jnl
Appl. Math. Comput.
Hui Liang, M. Z. Liu, Z. W. Yang
2012 J jnl
J. Appl. Math.
G. L. Zhang, Minghui Song, M. Z. Liu
2012 conf
ICDMA
Qinjian Zhang, Jian-yong Li, Yong-lin Cai, Heng Wang, X. Q. Yang, M. Z. Liu, L. M. Zhao
2011 J jnl
Appl. Math. Comput.
W. J. Lv, Z. W. Yang, M. Z. Liu
2010 J jnl
Appl. Math. Comput.
Guihua Zhao, Minghui Song, M. Z. Liu
2010 J jnl
Appl. Math. Lett.
Hui Liang, M. Z. Liu, Wanjin Lv
2009 J jnl
Comput. Math. Appl.
M. Z. Liu, J. F. Gao, Z. W. Yang
2009 J jnl
J. Comput. Appl. Math.
Z. W. Yang, M. Z. Liu, Juan J. Nieto
2008 J jnl
Math. Comput. Model.
X. J. Ran, M. Z. Liu, Q. Y. Zhu
2007 J jnl
Appl. Math. Comput.
M. Z. Liu, Jianfang Gao, Z. W. Yang
2007 J jnl
Comput. Math. Appl.
W. J. Lv, Z. W. Yang, M. Z. Liu
2007 J jnl
Appl. Math. Comput.
M. Z. Liu, Hui Liang, Z. W. Yang
2007 J jnl
Appl. Math. Comput.
W. J. Lv, Z. W. Yang, M. Z. Liu
2006 J jnl
Appl. Math. Comput.
Jingjun Zhao, Yang Xu, H. X. Wang, M. Z. Liu
2006 J jnl
Math. Comput.
M. Z. Liu, Z. W. Yang, Y. Xu
2005 J jnl
Appl. Math. Comput.
D. Li, M. Z. Liu
2005 J jnl
Appl. Math. Comput.
Jingjun Zhao, Yang Xu, M. Z. Liu
2005 J jnl
Appl. Math. Comput.
Jingjun Zhao, Yang Xu, S. Y. Dong, M. Z. Liu
2004 J jnl
Appl. Math. Comput.
M. Z. Liu, Dongsong Li
1989 J jnl
Computing
M. Z. Liu
redb/utils/push_to_elastic.py
← Index redb/utils/push_to_elastic.py python
import json
import os
#from redb.settings import elasticsearch as es
from elasticsearch import Elasticsearch
from dataclasses import asdict
from dotenv import load_dotenv

class Utils():
    """
    Utility class for pushing

    """
    @staticmethod
    def push_to_elastic(sample_dict):
        """
        Pushes the sample_dict to elastic search
        """
        load_dotenv()
        ELASTIC_ENDPOINT = os.getenv("ELASTIC_HOST")
        ELASTIC_ENFORCE_SSL = os.getenv("ELASTIC_ENFORCE_SSL", False) == "True"
        ELASTIC_USER = os.getenv("ELASTIC_USER")
        ELASTIC_PASSWORD = os.getenv("ELASTIC_PASSWORD")
        ELASTIC_BINARIES_COLLECTION = os.getenv(
            "ELASTIC_BINARIES_COLLECTION", "redb_test"
        )
        es = Elasticsearch(
            ELASTIC_ENDPOINT,
            verify_certs=ELASTIC_ENFORCE_SSL,
            basic_auth=(ELASTIC_USER, ELASTIC_PASSWORD),
            maxsize=20,
            retry_on_timeout=True,
            timeout=30,
        )

        try:
            dict_dump = json.dumps(sample_dict)
        except Exception as e:
            print(f"Error: {e}")
            return False
        elastic = es.index(index=ELASTIC_BINARIES_COLLECTION, body=dict_dump)
        return True
    
    def push_to_index(sample_dict, index_name):
        """
        Pushes the sample_dict to elastic search
        """
        load_dotenv()
        ELASTIC_ENDPOINT = os.getenv("ELASTIC_HOST")
        ELASTIC_ENFORCE_SSL = os.getenv("ELASTIC_ENFORCE_SSL", False) == "True"
        ELASTIC_USER = os.getenv("ELASTIC_USER")
        ELASTIC_PASSWORD = os.getenv("ELASTIC_PASSWORD")
        ELASTIC_BINARIES_COLLECTION = index_name
        
        es = Elasticsearch(
            ELASTIC_ENDPOINT,
            verify_certs=ELASTIC_ENFORCE_SSL,
            basic_auth=(ELASTIC_USER, ELASTIC_PASSWORD),
            maxsize=20,
            retry_on_timeout=True,
            timeout=30,
        )

        try:
            dict_dump = json.dumps(sample_dict)
        except Exception as e:
            print(f"Error: {e}")
            return False
        elastic = es.index(index=ELASTIC_BINARIES_COLLECTION, body=dict_dump)
        return True