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.1.tar.gz (11.4 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.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for muscles_data_elasticsearch-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0b84d1d95a07cfe6a512c7452f4da335945d5010902578b1609134fc0919e91c
MD5 ccf92d11667e97add7b36999b4bd0bf5
BLAKE2b-256 3a5b1440c0ed57c728f19ec9ba9a912a1d8484684d7b2095cb55cec72fb3ce6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for muscles_data_elasticsearch-0.1.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for muscles_data_elasticsearch-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b8afefe120346c9e024cd31360bacff7c9c404c9320446f1c6352601006fb247
MD5 10d4277ef00f7ff2e518fc1e0549daeb
BLAKE2b-256 2494169af245f4ef27a25b37fa789fec67d851b5287dd9e512455fd7ae274f54

See more details on using hashes here.

Provenance

The following attestation bundles were made for muscles_data_elasticsearch-0.1.1-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