NVIDIA Morpheus (24.10.01)
(Latest Version)

morpheus.controllers.elasticsearch_controller.ElasticsearchController

class ElasticsearchController(connection_kwargs, raise_on_exception=False, refresh_period_secs=2400)[source]

Bases: <a href="https://docs.python.org/3/library/functions.html#object">object</a>

ElasticsearchController to perform read and write operations using Elasticsearch service.

Parameters
connection_kwargsdict

Keyword arguments to configure the Elasticsearch connection.

raise_on_exceptionbool, optional, default: False

Whether to raise exceptions on Elasticsearch errors.

refresh_period_secsint, optional, default: 2400

The refresh period in seconds for client refreshing.

Methods

<a href="#morpheus.controllers.elasticsearch_controller.ElasticsearchController.close_client">close_client</a>() Close the Elasticsearch client connection.
<a href="#morpheus.controllers.elasticsearch_controller.ElasticsearchController.df_to_parallel_bulk_write">df_to_parallel_bulk_write</a>(index, df) Converts DataFrames to actions and parallel bulk writes to Elasticsearch.
<a href="#morpheus.controllers.elasticsearch_controller.ElasticsearchController.parallel_bulk_write">parallel_bulk_write</a>(actions) Perform parallel bulk writes to Elasticsearch.
<a href="#morpheus.controllers.elasticsearch_controller.ElasticsearchController.refresh_client">refresh_client</a>([force]) Refresh the Elasticsearch client instance.
<a href="#morpheus.controllers.elasticsearch_controller.ElasticsearchController.search_documents">search_documents</a>(index, query, **kwargs) Search for documents in Elasticsearch based on the given query.
close_client()[source]

Close the Elasticsearch client connection.

df_to_parallel_bulk_write(index, df)[source]

Converts DataFrames to actions and parallel bulk writes to Elasticsearch.

Parameters
indexstr

The name of the index to write.

dfpd.DataFrame

DataFrame entries that require writing to Elasticsearch.

parallel_bulk_write(actions)[source]

Perform parallel bulk writes to Elasticsearch.

Parameters
actionslist

List of actions to perform in parallel.

refresh_client(force=False)[source]

Refresh the Elasticsearch client instance.

Parameters
forcebool, optional, default: False

Force a client refresh.

Returns
bool

Returns true if client is refreshed, otherwise false.

search_documents(index, query, **kwargs)[source]

Search for documents in Elasticsearch based on the given query.

Parameters
indexstr

The name of the index to search.

querydict

The DSL query for the search.

**kwargs

Additional keyword arguments that are supported by the Elasticsearch search method.

Returns
dict

The search result returned by Elasticsearch.

Previous morpheus.controllers.elasticsearch_controller
Next morpheus.controllers.file_to_df_controller
© Copyright 2024, NVIDIA. Last updated on Dec 3, 2024.