File tree Expand file tree Collapse file tree 3 files changed +22
-20
lines changed
elasticsearch/stac_fastapi/elasticsearch
opensearch/stac_fastapi/opensearch Expand file tree Collapse file tree 3 files changed +22
-20
lines changed File renamed without changes.
Original file line number Diff line number Diff line change 2828 mk_actions ,
2929 mk_item_id ,
3030)
31+ from stac_fastapi .core .exceptions import BulkInsertError
3132from stac_fastapi .core .extensions import filter
3233from stac_fastapi .core .serializers import CollectionSerializer , ItemSerializer
3334from stac_fastapi .core .utilities import MAX_LIMIT , bbox2polygon
@@ -955,16 +956,16 @@ def _handle_bulk_result(
955956 """
956957 success_count , error_list = result
957958
958- # if raise_errors and error_list:
959- # error_messages = [
960- # f"Item {e['index']['_id']}: {e['index']['error']['reason']}"
961- # for e in error_list
962- # ]
963- # raise BulkInsertError(
964- # f"Bulk operation failed with {len(error_list)} errors",
965- # success_count=success_count,
966- # errors=error_messages,
967- # )
959+ if raise_errors and error_list :
960+ error_messages = [
961+ f"Item { e ['index' ]['_id' ]} : { e ['index' ]['error' ]['reason' ]} "
962+ for e in error_list
963+ ]
964+ raise BulkInsertError (
965+ f"Bulk operation failed with { len (error_list )} errors" ,
966+ success_count = success_count ,
967+ errors = error_messages ,
968+ )
968969
969970 return success_count , error_list
970971
Original file line number Diff line number Diff line change 3131 mk_actions ,
3232 mk_item_id ,
3333)
34+ from stac_fastapi .core .exceptions import BulkInsertError
3435from stac_fastapi .core .extensions import filter
3536from stac_fastapi .core .utilities import MAX_LIMIT , bbox2polygon
3637from stac_fastapi .opensearch .config import (
@@ -986,16 +987,16 @@ def _handle_bulk_result(
986987 """
987988 success_count , error_list = result
988989
989- # if raise_errors and error_list:
990- # error_messages = [
991- # f"Item {e['index']['_id']}: {e['index']['error']['reason']}"
992- # for e in error_list
993- # ]
994- # raise BulkInsertError(
995- # f"Bulk operation completed with {len(error_list)} errors",
996- # success_count=success_count,
997- # errors=error_messages,
998- # )
990+ if raise_errors and error_list :
991+ error_messages = [
992+ f"Item { e ['index' ]['_id' ]} : { e ['index' ]['error' ]['reason' ]} "
993+ for e in error_list
994+ ]
995+ raise BulkInsertError (
996+ f"Bulk operation completed with { len (error_list )} errors" ,
997+ success_count = success_count ,
998+ errors = error_messages ,
999+ )
9991000
10001001 return success_count , error_list
10011002
You can’t perform that action at this time.
0 commit comments