Ireneusz Gosciniak

14 papers B 1Misc 1Journal 6Unranked 6
YearRankTypeTitle / Venue / Authors
2022 conf
ICCS (1)
Ireneusz Gosciniak, Krzysztof Gdawiec
2021 B conf
KES
Ireneusz Gosciniak, Krzysztof Gdawiec, Krzysztof Wozniak, Monika Machoy
2020 J jnl
Soft Comput.
Ireneusz Gosciniak, Krzysztof Gdawiec
2020 J jnl
Entropy
Ireneusz Gosciniak, Krzysztof Gdawiec
2019 J jnl
Commun. Nonlinear Sci. Numer. Simul.
Ireneusz Gosciniak, Krzysztof Gdawiec
2019 J jnl
Soft Comput.
Ireneusz Gosciniak
2018 Misc conf
ISVC
Ireneusz Gosciniak, Krzysztof Gdawiec
2017 J jnl
Soft Comput.
Ireneusz Gosciniak
2015 J jnl
Expert Syst. Appl.
Ireneusz Gosciniak
2008 conf
CIMCA/IAWTIC/ISE
Ireneusz Gosciniak
2007 conf
GEM
Ireneusz Gosciniak
2005 conf
CIMCA/IAWTIC
Ireneusz Gosciniak
2005 conf
CIMCA/IAWTIC
Ireneusz Gosciniak
2004 conf
DFT
Ireneusz Gosciniak
redb/settings/elasticsearch.py
← Index redb/settings/elasticsearch.py python
import logging
import os

from elasticsearch import Elasticsearch
from dotenv import load_dotenv

load_dotenv()

# Elasticsearch configuration
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", "test_db")

# Cached client instance
_elasticsearch_client = None

def get_elasticsearch_client():
    """Get Elasticsearch client with lazy initialization and caching"""
    global _elasticsearch_client
    
    if _elasticsearch_client is None:
        if not ELASTIC_ENDPOINT:
            raise ValueError("ELASTIC_HOST environment variable is required for Elasticsearch connection")
            
        _elasticsearch_client = Elasticsearch(
            ELASTIC_ENDPOINT,
            verify_certs=ELASTIC_ENFORCE_SSL,
            basic_auth=(ELASTIC_USER, ELASTIC_PASSWORD),
            maxsize=20,
            retry_on_timeout=True,
            timeout=30,
        )
    
    return _elasticsearch_client

def create_elasticsearch_client():
    """Create a new Elasticsearch client connection (legacy function)"""
    return get_elasticsearch_client()