Elasticsearch and OpenSearch connector plugin for onestep.
Project description
onestep-elasticsearch
onestep-elasticsearch provides one asynchronous bulk sink for the common
Elasticsearch and OpenSearch HTTP API surface.
Install
pip install onestep-elasticsearch
Python
from onestep_elasticsearch import ElasticsearchConnector
search = ElasticsearchConnector(
["https://search-1:9200", "https://search-2:9200"],
distribution="auto",
username="ingest",
password="secret",
verify_certs=True,
ca_certs="/etc/ssl/search-ca.pem",
request_timeout_s=30.0,
)
sink = search.bulk_sink(
index="events-v1", operation="index", id_field="event_id",
chunk_size=500, max_chunk_bytes=5_000_000, refresh=False,
)
YAML
resources:
search:
type: elasticsearch
hosts: ["${SEARCH_URL}"]
distribution: auto
username: "${SEARCH_USERNAME}"
password: "${SEARCH_PASSWORD}"
verify_certs: true
ca_certs: "${SEARCH_CA_FILE:-/etc/ssl/certs/ca-certificates.crt}"
request_timeout_s: 30
events:
type: elasticsearch_bulk_sink
connector: search
index: events-v1
operation: index
id_field: event_id
chunk_size: 500
max_chunk_bytes: 5000000
refresh: false
Payloads and transport
send() accepts one mapping or one non-empty sequence of mappings. Each mapping
is the complete document _source; id_field also supplies _id while remaining
in _source. The sink chunks sequentially by action count and serialized NDJSON
bytes, and rejects invalid or oversized payloads before submission.
The common boundary uses HTTP(S), GET /, and POST /_bulk. distribution is
auto, elasticsearch, or opensearch. Configure exactly one authentication
mode: Basic username/password, api_key, or bearer_token. Custom headers,
verify_certs, ca_certs, client_cert, and client_key cover the supported TLS
and proxy boundary. Clients are created lazily; an injected client remains caller
owned, while a connector-owned client is closed by await connector.close().
Compatibility
The supported release matrix is Elasticsearch 8.x and 9.x plus OpenSearch 2.x and
3.x. Compatibility is defined by the shared HTTP bulk behavior, not a vendor Python
client version. The environment-gated live suite uses ONESTEP_ELASTICSEARCH_URL
or ONESTEP_OPENSEARCH_URL.
Delivery semantics
send() returns only after every bulk item in every chunk is acknowledged. onestep
acknowledges the source after sink sends, so a crash between the bulk acknowledgement
and source acknowledgement can duplicate output. Multi-sink fan-out is not
transactional. Use operation: index with a stable id_field when replay must
converge; auto-generated IDs and create are not replay-safe.
Bulk chunks are not transactional. Item failures retain a redacted typed cause with
the item index, status, identifier, and normalized reason. A partial commit is
reported as UNCERTAIN unless index with a stable id_field makes replay
deterministic. create conflicts and malformed documents are permanent failures.
Deferred features
Version 1 intentionally excludes Cloud ID, sniffing, SigV4, data streams,
administration APIs, dynamic actions, update/delete, PIT, SQL,
elasticsearch_search_after, and elasticsearch_scroll.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file onestep_elasticsearch-0.1.1.tar.gz.
File metadata
- Download URL: onestep_elasticsearch-0.1.1.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78220cf089416b9c0d6002a59763b7ae68716514a2287daf36526b52ed76cdc4
|
|
| MD5 |
d1d2eabd722fd7506539c1eae7244c3e
|
|
| BLAKE2b-256 |
e6566e242f14e4536e215ad47cf34d8d8d3a9720fc462a17205a97f3a9d7c2ff
|
File details
Details for the file onestep_elasticsearch-0.1.1-py3-none-any.whl.
File metadata
- Download URL: onestep_elasticsearch-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
670f765798dabac582d558e5c258eb1845ec8971fc1584fe0cd0ce2c74a00055
|
|
| MD5 |
a742d467018d0e69d9edf33b07402533
|
|
| BLAKE2b-256 |
7d084f1e63855fe7faa451a3f08a41b1ed72063ea8892ad3ee335bea1dfd8536
|