airflow.providers.opensearch.hooks.opensearch

Module Contents

Classes

OpenSearchHook

Provide a thin wrapper around the OpenSearch client.

class airflow.providers.opensearch.hooks.opensearch.OpenSearchHook(open_search_conn_id, log_query, open_search_conn_class=RequestsHttpConnection, **kwargs)[source]

Bases: airflow.hooks.base.BaseHook

Provide a thin wrapper around the OpenSearch client.

Parameters
  • open_search_conn_id (str) – Connection to use with OpenSearch

  • log_query (bool) – Whether to log the query used for OpenSearch

conn_name_attr = 'opensearch_conn_id'[source]
default_conn_name = 'opensearch_default'[source]
conn_type = 'opensearch'[source]
hook_name = 'OpenSearch Hook'[source]
conn()[source]
client()[source]

This function is intended for Operators that forward high level client objects.

search(query, index_name, **kwargs)[source]

Run a search query against the connected OpenSearch cluster.

Parameters
  • query (dict) – The query for the search against OpenSearch.

  • index_name (str) – The name of the index to search against

index(document, index_name, doc_id, **kwargs)[source]

Index a document on OpenSearch.

Parameters
  • document (dict) – A dictionary representation of the document

  • index_name (str) – the name of the index that this document will be associated with

  • doc_id (int) – the numerical identifier that will be used to identify the document on the index.

delete(index_name, query=None, doc_id=None)[source]

Delete from an index by either a query or by the document id.

Parameters
  • index_name (str) – the name of the index to delete from

  • query (dict | None) – If deleting by query a dict representation of the query to run to identify documents to delete.

  • doc_id (int | None) – The identifier of the document to delete.

classmethod get_ui_field_behaviour()[source]

Return custom UI field behaviour for OpenSearch Connection.

Was this entry helpful?