Skip to content

Commit 5723bba

Browse files
z-mrozujonhealy1
andauthored
Blocking bulk_items endpoint when ENABLE_DATETIME_INDEX_FILTERING (stac-utils#438)
**Description:** The `/collections/{collection_id}/bulk_items` endpoint does not work when `ENABLE_DATETIME_INDEX_FILTERING` is set to true, as only the async `/collections/{collection_id}/items` version was implemented while the sync `/collections/{collection_id}/bulk_items` wasn't. This PR blocks the /bulk_items endpoint when `ENABLE_DATETIME_INDEX_FILTERING` is set to true. **PR Checklist:** - [x] Code is formatted and linted (run `pre-commit run --all-files`) - [x] Tests pass (run `make test`) - [ ] Documentation has been updated to reflect changes, if applicable - [x] Changes are added to the changelog --------- Co-authored-by: Jonathan Healy <[email protected]>
1 parent ca26c0a commit 5723bba

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1616
### Changed
1717

1818
- Changed assets serialization to prevent mapping explosion while allowing asset inforamtion to be indexed. [#341](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/341)
19+
- Blocked the /collections/{collection_id}/bulk_items endpoint when environmental variable ENABLE_DATETIME_INDEX_FILTERING is set to true. [#438](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/438)
1920

2021
### Fixed
2122

stac_fastapi/core/stac_fastapi/core/core.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,13 @@ def bulk_item_insert(
965965
A string indicating the number of items successfully added.
966966
"""
967967
request = kwargs.get("request")
968+
969+
if os.getenv("ENABLE_DATETIME_INDEX_FILTERING"):
970+
raise HTTPException(
971+
status_code=400,
972+
detail="The /collections/{collection_id}/bulk_items endpoint is invalid when ENABLE_DATETIME_INDEX_FILTERING is set to true. Try using the /collections/{collection_id}/items endpoint.",
973+
)
974+
968975
if request:
969976
base_url = str(request.base_url)
970977
else:

0 commit comments

Comments
 (0)