August 2019
Intermediate to advanced
560 pages
13h 41m
English
Using the following code block, you can initialize a connection similar to the one that we used for the low-level client. The name of the connection is high_level_client and we can directly use it in the construction of different request objects:
from elasticsearch_dsl import connectionsclass ESLowLevelClientByConnection: __conn = None __conn_lock = threading.Lock() @staticmethod 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 def __init__ ...
Read now
Unlock full access