-
Notifications
You must be signed in to change notification settings - Fork 38
Add Custom Elasticsearch/OpenSearch Mappings Support #546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Hi, @jonhealy1 - this PR is ready for CR :) |
jonhealy1
left a comment
There was a problem hiding this 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.
|
Thanks! In hindsight I agree that mappings need the file-based alternative. I'll also leave current variable for quick overrides. So priority in what actually gets to set the mapping is: |
|
Hey @jonhealy1, I've implemented the requested changes |
jonhealy1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super cool thanks @bountx
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:
pre-commit run --all-files)make test)