[[integrations]]
== Integrations

You can find integration options and information on this page.


[discrete]
[[opentelemetry-intro]]
=== OpenTelemetry instrumentation

The Python Elasticsearch client supports native OpenTelemetry instrumentation following the https://opentelemetry.io/docs/specs/semconv/database/elasticsearch/[OpenTelemetry Semantic Conventions for Elasticsearch].
Refer to the <<opentelemetry>> page for details.


[discrete]
[[esql-intro]]
=== ES|QL

{ref}/esql.html[ES|QL] is available through the Python Elasticsearch client.
Refer to the <<esql-pandas>> page to learn more about using ES|QL and Pandas together with dataframes.


[discrete]
[[transport]]
=== Transport

The handling of connections, retries, and pooling is handled by the https://github.com/elastic/elastic-transport-python[Elastic Transport Python] library.
Documentation on the low-level classes is available on https://elastic-transport-python.readthedocs.io[Read the Docs].


[discrete]
[[opaque-id]]
=== Tracking requests with Opaque ID

You can enrich your requests against Elasticsearch with an identifier string, that allows you to discover this identifier in https://www.elastic.co/guide/en/elasticsearch/reference/current/logging.html#deprecation-logging[deprecation logs], to support you with https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-slowlog.html#_identifying_search_slow_log_origin[identifying search slow log origin]
or to help with https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html#_identifying_running_tasks[identifying running tasks].

The opaque ID can be set via the `opaque_id` parameter via the client `.options()` method:

[source,python]
------------------------------------
client = Elasticsearch(...)
client.options(opaque_id="request-id-...").search(...)
------------------------------------


[discrete]
[[type-hints]]
=== Type Hints

Starting in `elasticsearch-py` v7.10.0 the library now ships with https://www.python.org/dev/peps/pep-0484[type hints] and supports basic static type analysis with tools like http://mypy-lang.org[Mypy] and https://github.com/microsoft/pyright[Pyright].

If we write a script that has a type error like using `request_timeout` with a `str` argument instead of `float` and then run Mypy on the script:

[source,python]
------------------------------------
# script.py
from elasticsearch import Elasticsearch

client = Elasticsearch(...)
client.options(
    request_timeout="5"  # type error!
).search(...)

# $ mypy script.py
# script.py:5: error: Argument "request_timeout" to "search" of "Elasticsearch" has 
#                     incompatible type "str"; expected "Union[int, float, None]"
# Found 1 error in 1 file (checked 1 source file)
------------------------------------

Type hints also allow tools like your IDE to check types and provide better auto-complete functionality.


include::open-telemetry.asciidoc[]
include::esql-pandas.asciidoc[]