dxlelasticsearchclient.client module

class dxlelasticsearchclient.client.ElasticsearchClient(dxl_client, elasticsearch_service_unique_id=None)

Bases: dxlbootstrap.client.Client

The "Elasticsearch DXL Python Client Library" client wrapper class.

Constructor parameters:

Parameters:
  • dxl_client (dxlclient.client.DxlClient) -- The DXL client to use for communication with the fabric.
  • elasticsearch_service_unique_id (str) -- Unique id to use as part of the request topic names for the Elasticsearch DXL service.
delete(index, doc_type, id, **kwargs)

Deletes a typed JSON document from a specific index based on its id. See the Elasticsearch Python Delete API and Elasticsearch REST Delete API documentation for more information on the full set of available parameters and data format.

Parameters:
  • index (str) -- Name of the index.
  • doc_type (str) -- Type of the document.
  • id (str) -- ID of the document.
  • kwargs (dict) -- Dictionary of additional parameters to pass along to the Elasticsearch Python API.
Returns:

Result of the deletion attempt.

Return type:

dict

Raises:

elasticsearch.exceptions.NotFoundError -- If the document cannot be found.

get(index, doc_type, id, **kwargs)

Gets a typed JSON document from a specific index based on its id. See the Elasticsearch Python Get API and Elasticsearch REST Get API documentation for more information on the full set of available parameters and data format.

Parameters:
  • index (str) -- Name of the index.
  • doc_type (str) -- Type of the document.
  • id (str) -- ID of the document.
  • kwargs (dict) -- Dictionary of additional parameters to pass along to the Elasticsearch Python API.
Returns:

Result of the get attempt.

Return type:

dict

Raises:

elasticsearch.exceptions.NotFoundError -- If the document cannot be found.

index(index, doc_type, body, id=None, **kwargs)

Adds or updates a typed JSON document from a specific index based on its id. See the Elasticsearch Python Index API and Elasticsearch REST Index API documentation for more information on the full set of available parameters and data format.

Parameters:
  • index (str) -- Name of the index.
  • doc_type (str) -- Type of the document.
  • body (dict) -- The document.
  • id (str) -- ID of the document.
  • kwargs (dict) -- Dictionary of additional parameters to pass along to the Elasticsearch Python API.
Returns:

Result of the index attempt.

Return type:

dict

Raises:

elasticsearch.exceptions.NotFoundError -- If the document cannot be found.

update(index, doc_type, id, body=None, **kwargs)

Update a document based on a script or partial data provided. See the Elasticsearch Python Update API and Elasticsearch REST Update API documentation for more information on the full set of available parameters and data format.

Parameters:
  • index (str) -- Name of the index.
  • doc_type (str) -- Type of the document.
  • id (str) -- ID of the document.
  • body (dict) -- The request definition using either script or partial doc.
  • kwargs (dict) -- Dictionary of additional parameters to pass along to the Elasticsearch Python API.
Returns:

Result of the update attempt.

Return type:

dict

Raises:

elasticsearch.exceptions.NotFoundError -- If the document cannot be found.