Skip to content

Commit 6fe0de1

Browse files
authored
Update item method fix (#366)
**Related Issue(s):** - #75 **Description:** - Changed item update operation to use Elasticsearch index API instead of delete and create for better efficiency and atomicity. **PR Checklist:** - [x] Code is formatted and linted (run `pre-commit run --all-files`) - [x] Tests pass (run `make test`) - [x] Documentation has been updated to reflect changes, if applicable - [x] Changes are added to the changelog
1 parent 64d646f commit 6fe0de1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

CHANGELOG.md

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

1414
- Updated dynamic mapping for items to map long values to double versus float [#326](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/326)
1515
- Extended Datetime Search to search on start_datetime and end_datetime as well as datetime fields. [#182](https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/182)
16+
- Changed item update operation to use Elasticsearch index API instead of delete and create for better efficiency and atomicity. [#75](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/issues/75)
1617

1718
### Fixed
1819

stac_fastapi/core/stac_fastapi/core/core.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,8 +742,7 @@ async def update_item(
742742
item["properties"]["updated"] = now
743743

744744
await self.database.check_collection_exists(collection_id)
745-
await self.delete_item(item_id=item_id, collection_id=collection_id)
746-
await self.create_item(collection_id=collection_id, item=Item(**item), **kwargs)
745+
await self.database.create_item(item, refresh=kwargs.get("refresh", False))
747746

748747
return ItemSerializer.db_to_stac(item, base_url)
749748

0 commit comments

Comments
 (0)