本文整理汇总了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()
示例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()
示例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)
示例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)
示例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)