Skip to content

Conversation

@bountx
Copy link
Contributor

@bountx bountx commented Dec 2, 2025

Related Issue(s):

Description:

Adds configuration-based support for extending Elasticsearch/OpenSearch index mappings via environment variables, allowing users to customize field mappings without code changes.

Features:

  • STAC_FASTAPI_ES_CUSTOM_MAPPINGS - JSON string to inject custom field mappings (e.g., for SAR, datacube extensions, or performance optimizations)
  • STAC_FASTAPI_ES_DYNAMIC_MAPPING - Control dynamic field mapping behavior (true/false/strict)

PR Checklist:

  • Code is formatted and linted (run pre-commit run --all-files)
  • Tests pass (run make test)
  • Documentation has been updated to reflect changes, if applicable
  • Changes are added to the changelog

@bountx
Copy link
Contributor Author

bountx commented Dec 4, 2025

Hi, @jonhealy1 - this PR is ready for CR :)

Copy link
Collaborator

@jonhealy1 jonhealy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good work here. This is a great addition! Custom mappings are definitely needed.

However, I find that passing large, complex JSON blobs via environment variables (STAC_FASTAPI_ES_CUSTOM_MAPPINGS) can be quite awkward and error-prone in deployment scenarios (escaping quotes, line limits, etc.).

Could we please add support for a file-based alternative?

For example, introduce a STAC_FASTAPI_ES_MAPPINGS_FILE environment variable.

If STAC_FASTAPI_ES_MAPPINGS_FILE is set, the application reads the JSON content from that file path.

We can keep STAC_FASTAPI_ES_CUSTOM_MAPPINGS for quick overrides.

This would allow users to simply mount a mappings.json file (e.g., via a Kubernetes ConfigMap) which is a much cleaner operational pattern.

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.

2 participants