-
Notifications
You must be signed in to change notification settings - Fork 38
Quick and harmless fix to help with alternate OpenSearch schemas #553
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
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.
Hi @tloubrieu-jpl This looks really good. Can you add the same changes to the Elasticsearch backend. Thanks!
|
Hello @jonhealy1 , I made the extension to elasticsearch, I also realized that I initially missed some strings, derived from the constants newly defined, in the nested field syntax of elasticsearch/opensearch. I made this fix with the latest commit. I re-ran the tests (make test) as well and I noticed some errors (5) that I initially missed but sounds unrelated to te change of this PR. Thanks |
|
Tests pass here! @tloubrieu-jpl Thanks for making the updates. How would you feel about adding environment variables? This would make it a lot easier for developers to modify these fields. PROPERTIES_DATETIME_FIELD = os.getenv("STAC_FIELD_PROP_DATETIME", "properties.datetime")
PROPERTIES_START_DATETIME_FIELD = os.getenv("STAC_FIELD_PROP_START_DATETIME", "properties.start_datetime")
PROPERTIES_END_DATETIME_FIELD = os.getenv("STAC_FIELD_PROP_END_DATETIME", "properties.end_datetime")
COLLECTION_FIELD = os.getenv("STAC_FIELD_COLLECTION", "collection")
GEOMETRY_FIELD = os.getenv("STAC_FIELD_GEOMETRY", "geometry") |
Related Issue(s):
(I did not want to create a new ticket which could be redundant with this one)
Description:
Have opensearch datetime, geometry and collections fields defined as constant string so to be easily overwritten when the OpenSearch mapping requires it, as shown in example https://github.com/NASA-PDS/registry-stac-api/blob/464ce37952367fa845b325e36263b04a1fd89965/src/pds/registry/stac/database_logic.py#L28
PR Checklist:
pre-commit run --all-files)make test)