morpheus.controllers.elasticsearch_controller.ElasticsearchController

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

Bases: object

ElasticsearchController to perform read and write operations using Elasticsearch service.

Parameters
connection_kwargs

Keyword arguments to configure the Elasticsearch connection.

raise_on_exception

Whether to raise exceptions on Elasticsearch errors.

refresh_period_secs

The refresh period in seconds for client refreshing.

Methods

close_client() Close the Elasticsearch client connection.
df_to_parallel_bulk_write(index, df) Converts DataFrames to actions and parallel bulk writes to Elasticsearch.
parallel_bulk_write(actions) Perform parallel bulk writes to Elasticsearch.
refresh_client([force]) Refresh the Elasticsearch client instance.
search_documents(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
index

The name of the index to write.

df

DataFrame entries that require writing to Elasticsearch.

parallel_bulk_write(actions)[source]

Perform parallel bulk writes to Elasticsearch.

Parameters
actions

List of actions to perform in parallel.

refresh_client(force=False)[source]

Refresh the Elasticsearch client instance.

Parameters
force

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
index

The name of the index to search.

query

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 Apr 11, 2024.