airflow.providers.elasticsearch.log.es_response

Module Contents

Classes

AttributeList

Helper class to provide attribute like access to List objects.

AttributeDict

Helper class to provide attribute like access to Dictionary objects.

Hit

The Hit class is used to manage and access elements in a document.

HitMeta

The HitMeta class is used to manage and access metadata of a document.

ElasticSearchResponse

The ElasticSearchResponse class is used to manage and access the response from an Elasticsearch search.

class airflow.providers.elasticsearch.log.es_response.AttributeList(_list)[source]

Helper class to provide attribute like access to List objects.

__getitem__(k)[source]

Retrieve an item or a slice from the list. If the item is a dictionary, it is wrapped in an AttributeDict.

__iter__()[source]

Provide an iterator for the list or the dictionary.

__bool__()[source]

Check if the list is non-empty.

class airflow.providers.elasticsearch.log.es_response.AttributeDict(d)[source]

Helper class to provide attribute like access to Dictionary objects.

__getattr__(attr_name)[source]

Retrieve an item as an attribute from the dictionary.

__getitem__(key)[source]

Retrieve an item using a key from the dictionary.

to_dict()[source]
class airflow.providers.elasticsearch.log.es_response.Hit(document)[source]

Bases: AttributeDict

The Hit class is used to manage and access elements in a document.

It inherits from the AttributeDict class and provides attribute-like access to its elements, similar to a dictionary.

class airflow.providers.elasticsearch.log.es_response.HitMeta(document, exclude=('_source', '_fields'))[source]

Bases: AttributeDict

The HitMeta class is used to manage and access metadata of a document.

This class inherits from the AttributeDict class and provides attribute-like access to its elements.

class airflow.providers.elasticsearch.log.es_response.ElasticSearchResponse(search, response, doc_class=None)[source]

Bases: AttributeDict

The ElasticSearchResponse class is used to manage and access the response from an Elasticsearch search.

This class can be iterated over directly to access hits in the response. Indexing the class instance with an integer or slice will also access the hits. The class also evaluates to True if there are any hits in the response.

The hits property returns an AttributeList of hits in the response, with each hit transformed into an instance of the doc_class if provided.

The response parameter stores the dictionary returned by the Elasticsearch client search method.

property hits: list[Hit][source]

This property provides access to the hits (i.e., the results) of the Elasticsearch response.

The hits are represented as an AttributeList of Hit instances, which allow for easy, attribute-like access to the hit data.

The hits are lazily loaded, meaning they’re not processed until this property is accessed. Upon first access, the hits data from the response is processed using the _get_result method of the associated Search instance (i.e. an instance from ElasticsearchTaskHandler class), and the results are stored for future accesses.

Each hit also includes all the additional data present in the “hits” field of the response, accessible as attributes of the hit.

__iter__()[source]

Provide an iterator over the hits in the Elasticsearch response.

__getitem__(key)[source]

Retrieve a specific hit or a slice of hits from the Elasticsearch response.

__bool__()[source]

Evaluate the presence of hits in the Elasticsearch response.

Was this entry helpful?