Skip to content

Feat/elasticsearch connector#9

Merged
Grandvizir merged 13 commits intomainfrom
feat/elasticsearch-connector
Apr 8, 2026
Merged

Feat/elasticsearch connector#9
Grandvizir merged 13 commits intomainfrom
feat/elasticsearch-connector

Conversation

@Grandvizir
Copy link
Copy Markdown
Collaborator

Summary

Add an Elasticsearch connector to SCORE, allowing users to ingest documents from Elasticsearch indices alongside the
existing SharePoint, Confluence, and generic connectors.

Changes

  • New connector module (connectors/elasticsearch.py, 331 lines): Full Elasticsearch connector supporting API key,
    basic auth, and bearer token authentication. Uses PIT (Point in Time) + search_after for memory-efficient pagination
    with automatic fallback to helpers.scan() for older ES versions. Supports Elastic Cloud via cloud_id, configurable
    field mapping (content, title, author, date), optional query DSL filter, and TLS verification settings.
  • Model update (connectors/models.py): Added elasticsearch to ConnectorType choices.
  • Database migration (connectors/migrations/0003_add_elasticsearch_connector_type.py): Migration adding the new
    connector type.
  • UI templates (connectors/templates/connectors/_connector_cards.html, create.html, list.html): Added Elasticsearch
    config panels (hosts, cloud_id, index, auth method, username, content/title field mapping, TLS verification) and a
    yellow-accent Elasticsearch icon to the connector creation and listing pages.
  • Optional dependency (pyproject.toml, requirements.txt): Added elasticsearch>=8.0 as an optional extra (pip install
    score[elasticsearch]).
  • Connector registration (connectors/init.py): Registered the new connector in the connector registry.
  • Documentation (CHANGELOG.md, README.md, docs/INGESTION_AND_ANALYSIS.md, docs/configuration.md,
    docs/project-structure.md): Documented the connector's config keys, authentication methods, pagination strategy, and
    authority source weight (0.8).
  • Comprehensive tests (tests/test_elasticsearch_connector.py, 477 lines, 35 tests): Covers _parse_datetime utility,
    connector init/config parsing, client creation for all auth methods, test_connection, fetch_document (content
    detection, fallback extraction, custom field mapping), list_documents (PIT pagination, empty index, scan fallback),
    and Django model integration. Uses sys.modules mocking to avoid requiring the elasticsearch package at test time.

Test Plan

  • Tests pass (pytest)
  • Linting passes (ruff check .)
  • Manual testing done (describe below)
    • Create an Elasticsearch connector via the UI with API key auth
    • Create an Elasticsearch connector via the UI with basic auth
    • Verify connection test succeeds against a running Elasticsearch instance
    • Run ingestion and confirm documents are fetched and indexed in SCORE
    • Verify the connector card displays correctly with the Elasticsearch icon on the list page

Supports API key, basic auth, and bearer token authentication.
Uses search_after + PIT for efficient pagination with fallback to
helpers.scan(). Configurable field mapping, optional query filter,
and Elastic Cloud via cloud_id.
…ates

Adds connection form fields for hosts, cloud_id, index, auth method,
username, content/title field mapping, and TLS verification. Uses a
yellow accent icon (Elasticsearch brand color).
35 tests covering: _parse_datetime utility, connector init/config parsing,
client creation (API key, basic auth, bearer token, cloud_id, TLS),
test_connection, fetch_document (content detection, fallback extraction,
custom field mapping), list_documents (PIT pagination, empty index,
scan fallback), and Django model integration.

Uses sys.modules mocking to test lazy elasticsearch imports without
requiring the package to be installed. Also fixes deprecated
datetime.utcfromtimestamp() usage in the connector.
Update CHANGELOG, README, ingestion docs, configuration reference,
and project structure to document the new Elasticsearch connector,
its config keys, authentication methods, and pagination strategy.
Prevent test collection errors when third-party packages (openai,
tiktoken, networkx, datasketch, sqlite-vec) are not installed by
gracefully skipping affected test modules instead of erroring.
Resolves migration conflict between 0003_add_elasticsearch_connector_type
and 0003_add_encrypted_secret after merging main into the branch.
@Grandvizir Grandvizir merged commit 7f8c1dd into main Apr 8, 2026
2 checks passed
@Grandvizir Grandvizir deleted the feat/elasticsearch-connector branch April 8, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant