1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
[[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[]
|