Transport#

class elastic_transport.Transport(node_configs, node_class=<class 'elastic_transport.Urllib3HttpNode'>, node_pool_class=<class 'elastic_transport.NodePool'>, randomize_nodes_in_pool=True, node_selector_class=None, dead_node_backoff_factor=None, max_dead_node_backoff=None, serializers=None, default_mimetype='application/json', max_retries=3, retry_on_status=(429, 502, 503, 504), retry_on_timeout=False, sniff_on_start=False, sniff_before_requests=False, sniff_on_node_failure=False, sniff_timeout=0.5, min_delay_between_sniffing=10.0, sniff_callback=None, meta_header=True, client_meta_service=('et', '8.12.0'))#

Encapsulation of transport-related to logic. Handles instantiation of the individual nodes as well as creating a node pool to hold them.

Main interface is the elastic_transport.Transport.perform_request() method.

close()#

Explicitly closes all nodes in the transport’s pool

Return type:

None

perform_request(method, target, *, body=None, headers=DefaultType.value, max_retries=DefaultType.value, retry_on_status=DefaultType.value, retry_on_timeout=DefaultType.value, request_timeout=DefaultType.value, client_meta=DefaultType.value)#

Perform the actual request. Retrieve a node from the node pool, pass all the information to it’s perform_request method and return the data.

If an exception was raised, mark the node as failed and retry (up to max_retries times).

If the operation was successful and the node used was previously marked as dead, mark it as live, resetting it’s failure count.

Parameters:
Return type:

TransportApiResponse

Returns:

Tuple of the elastic_transport.ApiResponseMeta with the deserialized response.

class elastic_transport.AsyncTransport(node_configs, node_class=<class 'elastic_transport.AiohttpHttpNode'>, node_pool_class=<class 'elastic_transport.NodePool'>, randomize_nodes_in_pool=True, node_selector_class=None, dead_node_backoff_factor=None, max_dead_node_backoff=None, serializers=None, default_mimetype='application/json', max_retries=3, retry_on_status=(429, 502, 503, 504), retry_on_timeout=False, sniff_on_start=False, sniff_before_requests=False, sniff_on_node_failure=False, sniff_timeout=0.5, min_delay_between_sniffing=10.0, sniff_callback=None, meta_header=True, client_meta_service=('et', '8.12.0'))#

Encapsulation of transport-related to logic. Handles instantiation of the individual nodes as well as creating a node pool to hold them.

Main interface is the elastic_transport.Transport.perform_request() method.

async close()#

Explicitly closes all nodes in the transport’s pool

Return type:

None

async perform_request(method, target, *, body=None, headers=DefaultType.value, max_retries=DefaultType.value, retry_on_status=DefaultType.value, retry_on_timeout=DefaultType.value, request_timeout=DefaultType.value, client_meta=DefaultType.value)#

Perform the actual request. Retrieve a node from the node pool, pass all the information to it’s perform_request method and return the data.

If an exception was raised, mark the node as failed and retry (up to max_retries times).

If the operation was successful and the node used was previously marked as dead, mark it as live, resetting it’s failure count.

Parameters:
Return type:

TransportApiResponse

Returns:

Tuple of the elastic_transport.ApiResponseMeta with the deserialized response.