當前位置: 首頁>>代碼示例>>Python>>正文


Python connections.create_connection方法代碼示例

本文整理匯總了Python中elasticsearch_dsl.connections.create_connection方法的典型用法代碼示例。如果您正苦於以下問題:Python connections.create_connection方法的具體用法?Python connections.create_connection怎麽用?Python connections.create_connection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在elasticsearch_dsl.connections的用法示例。


在下文中一共展示了connections.create_connection方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from elasticsearch_dsl import connections [as 別名]
# 或者: from elasticsearch_dsl.connections import create_connection [as 別名]
def __init__(self, settings):

        self.CONNECTION_URI = settings.get('INVANA_BOT_SETTINGS', {}).get('HTTPCACHE_STORAGE_SETTINGS', {}).get(
            "CONNECTION_URI", None)
        self.database_name = settings.get('INVANA_BOT_SETTINGS', {}).get('HTTPCACHE_STORAGE_SETTINGS', {}).get(
            "DATABASE_NAME", None)
        self.cache_expiry_time = settings.get('INVANA_BOT_SETTINGS', {}).get('HTTPCACHE_STORAGE_SETTINGS', {}).get(
            "EXPIRY_TIME", None)
        self.collection_name = settings.get('INVANA_BOT_SETTINGS', {}).get('HTTPCACHE_STORAGE_SETTINGS', {}).get(
            "COLLECTION_NAME", None)
        connections.create_connection(hosts=[self.CONNECTION_URI])
        self.WebLink = self.setup_collection()
        self.WebLink.init() 
開發者ID:invanalabs,項目名稱:invana-bot,代碼行數:15,代碼來源:elasticsearch.py

示例2: __init__

# 需要導入模塊: from elasticsearch_dsl import connections [as 別名]
# 或者: from elasticsearch_dsl.connections import create_connection [as 別名]
def __init__(self, connection_uri=None,
                 database_name=None,
                 collection_name=None):
        self.connection_uri = connection_uri
        self.database_name = database_name
        self.collection_name = collection_name
        connections.create_connection(hosts=[self.connection_uri])
        self.WebLinkExtracted = self.setup_collection()
        self.WebLinkExtracted.init() 
開發者ID:invanalabs,項目名稱:invana-bot,代碼行數:11,代碼來源:elasticsearch.py

示例3: get_instance

# 需要導入模塊: from elasticsearch_dsl import connections [as 別名]
# 或者: from elasticsearch_dsl.connections import create_connection [as 別名]
def get_instance():
        if ESLowLevelClientByConnection.__conn is None:
            with ESLowLevelClientByConnection.__conn_lock:
                if ESLowLevelClientByConnection.__conn is None:
                    ESLowLevelClientByConnection.__conn = connections.create_connection('high_level_client', hosts=['localhost'], port=9200)
        return ESLowLevelClientByConnection.__conn 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:8,代碼來源:low_level_client_by_connection.py

示例4: _create_connection

# 需要導入模塊: from elasticsearch_dsl import connections [as 別名]
# 或者: from elasticsearch_dsl.connections import create_connection [as 別名]
def _create_connection(self, name, default_cluster_config, additional_clusters_config):
        config = default_cluster_config
        if additional_clusters_config and name in additional_clusters_config and additional_clusters_config[name]:
            config = additional_clusters_config[name]
    
        connection_config = {
            'hosts': config['hosts'],
            'timeout': 60
        }
        if 'user' in config and config['user']  \
            and 'password' in config and config['password']:
            connection_config['http_auth'] = (config['user'], config['password'])
        
        connections.create_connection(name, **connection_config) 
開發者ID:bitshares,項目名稱:bitshares-explorer-api,代碼行數:16,代碼來源:bitshares_elasticsearch_client.py

示例5: _evidences_for_pc

# 需要導入模塊: from elasticsearch_dsl import connections [as 別名]
# 或者: from elasticsearch_dsl.connections import create_connection [as 別名]
def _evidences_for_pc(self, path):
        path = Path(path)
        pc = PaperCollection.from_pickle(path)
        cell_evidences = CellEvidenceExtractor()
        connections.create_connection(hosts=['10.0.1.145'], timeout=20)
        raw_evidences = []
        for paper in tqdm(pc):
            raw_evidences.append(cell_evidences(paper, paper.tables, paper_limit=100, corpus_limit=20))
        raw_evidences = pd.concat(raw_evidences)
        path = path.with_suffix(".evidences.pkl")
        raw_evidences.to_pickle(path) 
開發者ID:paperswithcode,項目名稱:axcell,代碼行數:13,代碼來源:precompute_evidences.py

示例6: setup_default_connection

# 需要導入模塊: from elasticsearch_dsl import connections [as 別名]
# 或者: from elasticsearch_dsl.connections import create_connection [as 別名]
def setup_default_connection():
    # TODO: extract that to settings / configuraiton
    connections.create_connection(**config.elastic) 
開發者ID:paperswithcode,項目名稱:axcell,代碼行數:5,代碼來源:elastic.py


注:本文中的elasticsearch_dsl.connections.create_connection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。