当前位置: 首页>>代码示例>>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;未经允许,请勿转载。