Skip to main content

Elasticsearch SearchIndexPort adapter for muscles-data

Project description

muscles-data-elasticsearch

Elasticsearch adapter package for muscles-data.

This package is intentionally separate from muscles-data: the core package owns typed ports, resource runtime and diagnostics, while this package owns the Elasticsearch-backed SearchIndexPort implementation.

Related packages

Usage

Register the factory in the project composition root:

from muscles_data.catalog import DataAdapterCatalog
from muscles_data.ports import SearchIndexPort
from muscles_data.runtime import DataRuntime
from muscles_data_elasticsearch import ElasticsearchSearchFactory

catalog = DataAdapterCatalog.with_defaults()
catalog.register(ElasticsearchSearchFactory())

runtime = DataRuntime(config=config, catalog=catalog)
search = runtime.require_port("search.elastic", SearchIndexPort)

Resource config stays in the project:

data:
  resources:
    search.elastic:
      type: elasticsearch
      url_env: ELASTICSEARCH_URL
      api_key: ${ELASTICSEARCH_API_KEY}
      index: docs
      timeout: 3
      verify_certs: true

The adapter creates the Elasticsearch client and index lazily on search, index/delete, explicit native access or data.doctor. Application code should use SearchIndexPort; direct client access is only an advanced escape hatch with native_client: true.

Missing indexes are created with a default mapping for text, title and metadata; mapping and settings resource options can customize it. upsert_documents() uses Elasticsearch bulk operations.

See muscular-example/example_data_elasticsearch_1 for an executable example.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

muscles_data_elasticsearch-0.1.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

muscles_data_elasticsearch-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file muscles_data_elasticsearch-0.1.0.tar.gz.

File metadata

File hashes

Hashes for muscles_data_elasticsearch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 40ee43537939c922108d4822e0245c4bab1021c64a30aa1cd200cf03a3bb5667
MD5 a03ed14d8c170fdb7498d9abf034ad24
BLAKE2b-256 64b826e64267b15506497db6555b67b747ed576d82f6980617c30a585cf3e887

See more details on using hashes here.

Provenance

The following attestation bundles were made for muscles_data_elasticsearch-0.1.0.tar.gz:

Publisher: release.yml on butkoden/muscles-data-elasticsearch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file muscles_data_elasticsearch-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for muscles_data_elasticsearch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 53eb986d0fbf53c4588dc0496414f5b892419020e3149a26804b73390bdc1a00
MD5 b6d5b92261b47e4f2b1365810729e847
BLAKE2b-256 d90ca33404e2b4327205293d61a600ca1019e36001877606637efd117751e8e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for muscles_data_elasticsearch-0.1.0-py3-none-any.whl:

Publisher: release.yml on butkoden/muscles-data-elasticsearch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page