Skip to content

Commit 1c15d33

Browse files
committed
add check for floats
1 parent 80e224b commit 1c15d33

File tree

2 files changed

+428
-1
lines changed

2 files changed

+428
-1
lines changed

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/transactions.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ def create_item(self, model: stac_types.Item, **kwargs):
3939
).create_links()
4040
model["links"] = item_links
4141

42+
# elasticsearch doesn't like the fact that some values are float and some were int
43+
if "eo:bands" in model["properties"]:
44+
for wave in model["properties"]["eo:bands"]:
45+
for k, v in wave.items():
46+
if type(v) != str:
47+
v = float(v)
48+
wave.update({k: v})
49+
4250
if not self.client.exists(index="stac_collections", id=model["collection"]):
4351
raise ForeignKeyError(f"Collection {model['collection']} does not exist")
4452

0 commit comments

Comments
 (0)