Weigao Xie

12 papers B 3C 1Journal 3Unranked 5
YearRankTypeTitle / Venue / Authors
2011 J jnl
Comput. Commun.
Mukul Goyal, Dawn Rohm, Weigao Xie, Seyed H. Hosseini, Kishor S. Trivedi, Yusuf Bashir, August Divjak
2011 J jnl
Mob. Inf. Syst.
Mukul Goyal, Weigao Xie, Seyed Hossein Hosseini
2010 conf
NBiS
Weigao Xie, Mukul Goyal, Seyed Hossein Hosseini, Jerald Martocci, Yusuf Bashir, Emmanuel Baccelli, Arjan Durresi
2010 conf
BWCCA
Mukul Goyal, Weigao Xie, Seyed Hossein Hosseini, Yusuf Bashir
2010 conf
NBiS
Mukul Goyal, S. Prakash, Weigao Xie, Yusuf Bashir, Seyed Hossein Hosseini, Arjan Durresi
2010 B conf
AINA
Weigao Xie, Mukul Goyal, Seyed Hossein Hosseini, Jerald Martocci, Yusuf Bashir, Emmanuel Baccelli, Arjan Durresi
2009 B conf
GLOBECOM
Dawn Rohm, Mukul Goyal, Weigao Xie, Balaji Polepalli, Seyed Hossein Hosseini, August Divjak, Yusuf Bashir
2009 conf
NBiS
Weigao Xie, Balaji Polepalli, Mukul Goyal, Seyed Hossein Hosseini
2009 conf
AINA Workshops
Balaji Polepalli, Weigao Xie, Dhanashree Thangaraja, Mukul Goyal, Seyed Hossein Hosseini, Yusuf Bashir
2007 C conf
BROADNETS
Mukul Goyal, Weigao Xie, Mohd Soperi, Seyed H. Hosseini, K. Vairavan
2006 J jnl
Simul.
Mukul Goyal, Weigao Xie, Seyed H. Hosseini, K. Vairavan, Dawn Rohm
2005 B conf
MASCOTS
Mukul Goyal, Weigao Xie, Seyed H. Hosseini, K. Vairavan
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