Skip to content

OpenSearch API#

Handle#

[source]

get_opensearch_api#

Project.get_opensearch_api()

Get the opensearch api for the project.

Returns

OpenSearchApi: The OpenSearch Api handle


Methods#

[source]

get_default_py_config#

OpenSearchApi.get_default_py_config()

Get the required opensearch configuration to setup a connection using the opensearch-py library.

import hopsworks
from opensearchpy import OpenSearch

connection = hopsworks.connection()

project = connection.get_project()

opensearch_api = project.get_opensearch_api()

client = OpenSearch(**opensearch_api.get_default_py_config())
Returns: A dictionary with required configuration.


[source]

get_project_index#

OpenSearchApi.get_project_index(index)

This helper method prefixes the supplied index name with the project name to avoid index name clashes.

Args: :index: the opensearch index to interact with.

Returns: A valid opensearch index name.