airflow.providers.opensearch.operators.opensearch

Module Contents

Classes

OpenSearchQueryOperator

Run a query search against a given index on an OpenSearch cluster and returns results.

OpenSearchCreateIndexOperator

Create a new index on an OpenSearch cluster with a given index name.

OpenSearchAddDocumentOperator

Add a new document to a given Index or overwrite an existing one.

class airflow.providers.opensearch.operators.opensearch.OpenSearchQueryOperator(*, query=None, search_object=None, index_name=None, opensearch_conn_id='opensearch_default', opensearch_conn_class=RequestsHttpConnection, log_query=True, **kwargs)[source]

Bases: airflow.models.BaseOperator

Run a query search against a given index on an OpenSearch cluster and returns results.

See also

For more information on how to use this operator, take a look at the guide: Run a query against an OpenSearch Index

Parameters
  • query (dict | None) – A Dictionary OpenSearch DSL query.

  • search_object (Any | None) – A Search object from opensearch-dsl.

  • index_name (str | None) – The name of the index to search for documents.

  • opensearch_conn_id (str) – opensearch connection to use

  • opensearch_conn_class (type[opensearchpy.Connection] | None) – opensearch connection class to use

  • log_query (bool) – Whether to log the query used. Defaults to True and logs query used.

template_fields: Sequence[str] = ['query'][source]
hook()[source]

Get an instance of an OpenSearchHook.

execute(context)[source]

Execute a search against a given index or a Search object on an OpenSearch Cluster.

class airflow.providers.opensearch.operators.opensearch.OpenSearchCreateIndexOperator(*, index_name, index_body, opensearch_conn_id='opensearch_default', **kwargs)[source]

Bases: airflow.models.BaseOperator

Create a new index on an OpenSearch cluster with a given index name.

See also

For more information on how to use this operator, take a look at the guide: Create an Index in OpenSearch

Parameters
  • index_name (str) – The name of the index to be created.

  • index_body (dict[str, Any]) – A dictionary that defines index settings

  • opensearch_conn_id (str) – opensearch connection to use

hook()[source]

Get an instance of an OpenSearchHook.

execute(context)[source]

Create an index on an OpenSearch cluster.

class airflow.providers.opensearch.operators.opensearch.OpenSearchAddDocumentOperator(*, index_name=None, document=None, doc_id=None, doc_class=None, opensearch_conn_id='opensearch_default', **kwargs)[source]

Bases: airflow.models.BaseOperator

Add a new document to a given Index or overwrite an existing one.

See also

For more information on how to use this operator, take a look at the guide: Add a Document to an Index on OpenSearch

Parameters
  • index_name (str | None) – The name of the index to put the document.

  • document (dict[str, Any] | None) – A dictionary representation of the document.

  • document_id – The id for the document in the index.

  • doc_class (Any | None) – A Document subclassed object using opensearch-dsl

  • opensearch_conn_id (str) – opensearch connection to use

hook()[source]

Get an instance of an OpenSearchHook.

execute(context)[source]

Save a document to a given index on an OpenSearch cluster.

Was this entry helpful?