File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
stac_fastapi/elasticsearch/stac_fastapi/elasticsearch Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -54,9 +54,21 @@ def _create_item_index(self):
54
54
def create_item (self , model : stac_types .Item , ** kwargs ):
55
55
"""Create item."""
56
56
base_url = str (kwargs ["request" ].base_url )
57
-
58
57
self ._create_item_index ()
59
58
59
+ # If a feature collection is posted
60
+ if model ["type" ] == "FeatureCollection" :
61
+ bulk_client = BulkTransactionsClient ()
62
+ processed_items = [
63
+ bulk_client ._preprocess_item (item , base_url )
64
+ for item in model ["features" ]
65
+ ]
66
+ return_msg = f"Successfully added { len (processed_items )} items."
67
+ bulk_client .bulk_sync (processed_items )
68
+
69
+ return return_msg
70
+
71
+ # If a single item is posted
60
72
if not self .client .exists (index = "stac_collections" , id = model ["collection" ]):
61
73
raise ForeignKeyError (f"Collection { model ['collection' ]} does not exist" )
62
74
You can’t perform that action at this time.
0 commit comments