stac-fastapi.opensearch 3.2.2__tar.gz → 3.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/PKG-INFO +8 -7
- {stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/README.md +6 -6
- {stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/setup.py +2 -1
- {stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/stac_fastapi/opensearch/database_logic.py +26 -12
- {stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/stac_fastapi/opensearch/version.py +1 -1
- {stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/stac_fastapi.opensearch.egg-info/PKG-INFO +8 -7
- {stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/stac_fastapi.opensearch.egg-info/requires.txt +1 -1
- {stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/setup.cfg +0 -0
- {stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/stac_fastapi/opensearch/__init__.py +0 -0
- {stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/stac_fastapi/opensearch/app.py +0 -0
- {stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/stac_fastapi/opensearch/config.py +0 -0
- {stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/stac_fastapi.opensearch.egg-info/SOURCES.txt +0 -0
- {stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/stac_fastapi.opensearch.egg-info/dependency_links.txt +0 -0
- {stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/stac_fastapi.opensearch.egg-info/entry_points.txt +0 -0
- {stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/stac_fastapi.opensearch.egg-info/not-zip-safe +0 -0
- {stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/stac_fastapi.opensearch.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: stac_fastapi.opensearch
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.4
|
|
4
4
|
Summary: Opensearch stac-fastapi backend.
|
|
5
5
|
Home-page: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch
|
|
6
6
|
License: MIT
|
|
@@ -12,6 +12,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
16
|
Classifier: License :: OSI Approved :: MIT License
|
|
16
17
|
Requires-Python: >=3.8
|
|
17
18
|
Description-Content-Type: text/markdown
|
|
@@ -288,17 +289,17 @@ A reindex operation might be useful to apply changes to documents or to correct
|
|
|
288
289
|
|
|
289
290
|
The index templates will make sure that manually created indices will also have the correct mappings and settings.
|
|
290
291
|
|
|
291
|
-
In this example, we will make a copy of an existing Item index `items_my-collection-000001` but change the Item identifier to be lowercase.
|
|
292
|
+
In this example, we will make a copy of an existing Item index `items_my-collection-lower_my-collection-hex-000001` but change the Item identifier to be lowercase.
|
|
292
293
|
|
|
293
294
|
```shell
|
|
294
295
|
curl -X "POST" "http://localhost:9200/_reindex" \
|
|
295
296
|
-H 'Content-Type: application/json' \
|
|
296
297
|
-d $'{
|
|
297
298
|
"source": {
|
|
298
|
-
"index": "items_my-collection-000001"
|
|
299
|
+
"index": "items_my-collection-lower_my-collection-hex-000001"
|
|
299
300
|
},
|
|
300
301
|
"dest": {
|
|
301
|
-
"index": "items_my-collection-000002"
|
|
302
|
+
"index": "items_my-collection-lower_my-collection-hex-000002"
|
|
302
303
|
},
|
|
303
304
|
"script": {
|
|
304
305
|
"source": "ctx._source.id = ctx._source.id.toLowerCase()",
|
|
@@ -307,7 +308,7 @@ curl -X "POST" "http://localhost:9200/_reindex" \
|
|
|
307
308
|
}'
|
|
308
309
|
```
|
|
309
310
|
|
|
310
|
-
If we are happy with the data in the newly created index, we can move the alias `items_my-collection` to the new index `items_my-collection-000002`.
|
|
311
|
+
If we are happy with the data in the newly created index, we can move the alias `items_my-collection` to the new index `items_my-collection-lower_my-collection-hex-000002`.
|
|
311
312
|
```shell
|
|
312
313
|
curl -X "POST" "http://localhost:9200/_aliases" \
|
|
313
314
|
-h 'Content-Type: application/json' \
|
|
@@ -321,7 +322,7 @@ curl -X "POST" "http://localhost:9200/_aliases" \
|
|
|
321
322
|
},
|
|
322
323
|
{
|
|
323
324
|
"add": {
|
|
324
|
-
"index": "items_my-collection-000002",
|
|
325
|
+
"index": "items_my-collection-lower_my-collection-hex-000002",
|
|
325
326
|
"alias": "items_my-collection"
|
|
326
327
|
}
|
|
327
328
|
}
|
|
@@ -338,7 +339,7 @@ Authentication is an optional feature that can be enabled through `Route Depende
|
|
|
338
339
|
|
|
339
340
|
## Aggregation
|
|
340
341
|
|
|
341
|
-
Aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates is supported in stac-fatsapi-elasticsearch-opensearch. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). Details for supported aggregations can be found
|
|
342
|
+
Aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates is supported in stac-fatsapi-elasticsearch-opensearch. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). Details for supported aggregations can be found in [the aggregation docs](./docs/src/aggregation.md)
|
|
342
343
|
|
|
343
344
|
## Rate Limiting
|
|
344
345
|
|
|
@@ -267,17 +267,17 @@ A reindex operation might be useful to apply changes to documents or to correct
|
|
|
267
267
|
|
|
268
268
|
The index templates will make sure that manually created indices will also have the correct mappings and settings.
|
|
269
269
|
|
|
270
|
-
In this example, we will make a copy of an existing Item index `items_my-collection-000001` but change the Item identifier to be lowercase.
|
|
270
|
+
In this example, we will make a copy of an existing Item index `items_my-collection-lower_my-collection-hex-000001` but change the Item identifier to be lowercase.
|
|
271
271
|
|
|
272
272
|
```shell
|
|
273
273
|
curl -X "POST" "http://localhost:9200/_reindex" \
|
|
274
274
|
-H 'Content-Type: application/json' \
|
|
275
275
|
-d $'{
|
|
276
276
|
"source": {
|
|
277
|
-
"index": "items_my-collection-000001"
|
|
277
|
+
"index": "items_my-collection-lower_my-collection-hex-000001"
|
|
278
278
|
},
|
|
279
279
|
"dest": {
|
|
280
|
-
"index": "items_my-collection-000002"
|
|
280
|
+
"index": "items_my-collection-lower_my-collection-hex-000002"
|
|
281
281
|
},
|
|
282
282
|
"script": {
|
|
283
283
|
"source": "ctx._source.id = ctx._source.id.toLowerCase()",
|
|
@@ -286,7 +286,7 @@ curl -X "POST" "http://localhost:9200/_reindex" \
|
|
|
286
286
|
}'
|
|
287
287
|
```
|
|
288
288
|
|
|
289
|
-
If we are happy with the data in the newly created index, we can move the alias `items_my-collection` to the new index `items_my-collection-000002`.
|
|
289
|
+
If we are happy with the data in the newly created index, we can move the alias `items_my-collection` to the new index `items_my-collection-lower_my-collection-hex-000002`.
|
|
290
290
|
```shell
|
|
291
291
|
curl -X "POST" "http://localhost:9200/_aliases" \
|
|
292
292
|
-h 'Content-Type: application/json' \
|
|
@@ -300,7 +300,7 @@ curl -X "POST" "http://localhost:9200/_aliases" \
|
|
|
300
300
|
},
|
|
301
301
|
{
|
|
302
302
|
"add": {
|
|
303
|
-
"index": "items_my-collection-000002",
|
|
303
|
+
"index": "items_my-collection-lower_my-collection-hex-000002",
|
|
304
304
|
"alias": "items_my-collection"
|
|
305
305
|
}
|
|
306
306
|
}
|
|
@@ -317,7 +317,7 @@ Authentication is an optional feature that can be enabled through `Route Depende
|
|
|
317
317
|
|
|
318
318
|
## Aggregation
|
|
319
319
|
|
|
320
|
-
Aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates is supported in stac-fatsapi-elasticsearch-opensearch. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). Details for supported aggregations can be found
|
|
320
|
+
Aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates is supported in stac-fatsapi-elasticsearch-opensearch. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). Details for supported aggregations can be found in [the aggregation docs](./docs/src/aggregation.md)
|
|
321
321
|
|
|
322
322
|
## Rate Limiting
|
|
323
323
|
|
|
@@ -6,7 +6,7 @@ with open("README.md") as f:
|
|
|
6
6
|
desc = f.read()
|
|
7
7
|
|
|
8
8
|
install_requires = [
|
|
9
|
-
"stac-fastapi.core==3.2.
|
|
9
|
+
"stac-fastapi.core==3.2.4",
|
|
10
10
|
"opensearch-py==2.4.2",
|
|
11
11
|
"opensearch-py[async]==2.4.2",
|
|
12
12
|
"uvicorn",
|
|
@@ -42,6 +42,7 @@ setup(
|
|
|
42
42
|
"Programming Language :: Python :: 3.10",
|
|
43
43
|
"Programming Language :: Python :: 3.11",
|
|
44
44
|
"Programming Language :: Python :: 3.12",
|
|
45
|
+
"Programming Language :: Python :: 3.13",
|
|
45
46
|
"License :: OSI Approved :: MIT License",
|
|
46
47
|
],
|
|
47
48
|
url="https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch",
|
|
@@ -158,7 +158,20 @@ def index_by_collection_id(collection_id: str) -> str:
|
|
|
158
158
|
Returns:
|
|
159
159
|
str: The index name derived from the collection id.
|
|
160
160
|
"""
|
|
161
|
-
return f"{ITEMS_INDEX_PREFIX}{''.join(c for c in collection_id.lower() if c not in ES_INDEX_NAME_UNSUPPORTED_CHARS)}"
|
|
161
|
+
return f"{ITEMS_INDEX_PREFIX}{''.join(c for c in collection_id.lower() if c not in ES_INDEX_NAME_UNSUPPORTED_CHARS)}_{collection_id.encode('utf-8').hex()}"
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def index_alias_by_collection_id(collection_id: str) -> str:
|
|
165
|
+
"""
|
|
166
|
+
Translate a collection id into an Elasticsearch index alias.
|
|
167
|
+
|
|
168
|
+
Args:
|
|
169
|
+
collection_id (str): The collection id to translate into an index alias.
|
|
170
|
+
|
|
171
|
+
Returns:
|
|
172
|
+
str: The index alias derived from the collection id.
|
|
173
|
+
"""
|
|
174
|
+
return f"{ITEMS_INDEX_PREFIX}{''.join(c for c in collection_id if c not in ES_INDEX_NAME_UNSUPPORTED_CHARS)}"
|
|
162
175
|
|
|
163
176
|
|
|
164
177
|
def indices(collection_ids: Optional[List[str]]) -> str:
|
|
@@ -174,7 +187,7 @@ def indices(collection_ids: Optional[List[str]]) -> str:
|
|
|
174
187
|
if collection_ids is None or collection_ids == []:
|
|
175
188
|
return ITEM_INDICES
|
|
176
189
|
else:
|
|
177
|
-
return ",".join([
|
|
190
|
+
return ",".join([index_alias_by_collection_id(c) for c in collection_ids])
|
|
178
191
|
|
|
179
192
|
|
|
180
193
|
async def create_index_templates() -> None:
|
|
@@ -243,13 +256,14 @@ async def create_item_index(collection_id: str):
|
|
|
243
256
|
|
|
244
257
|
"""
|
|
245
258
|
client = AsyncSearchSettings().create_client
|
|
246
|
-
index_name = index_by_collection_id(collection_id)
|
|
247
259
|
search_body: Dict[str, Any] = {
|
|
248
|
-
"aliases": {
|
|
260
|
+
"aliases": {index_alias_by_collection_id(collection_id): {}},
|
|
249
261
|
}
|
|
250
262
|
|
|
251
263
|
try:
|
|
252
|
-
await client.indices.create(
|
|
264
|
+
await client.indices.create(
|
|
265
|
+
index=f"{index_by_collection_id(collection_id)}-000001", body=search_body
|
|
266
|
+
)
|
|
253
267
|
except TransportError as e:
|
|
254
268
|
if e.status_code == 400:
|
|
255
269
|
pass # Ignore 400 status codes
|
|
@@ -267,7 +281,7 @@ async def delete_item_index(collection_id: str):
|
|
|
267
281
|
"""
|
|
268
282
|
client = AsyncSearchSettings().create_client
|
|
269
283
|
|
|
270
|
-
name =
|
|
284
|
+
name = index_alias_by_collection_id(collection_id)
|
|
271
285
|
resolved = await client.indices.resolve_index(name=name)
|
|
272
286
|
if "aliases" in resolved and resolved["aliases"]:
|
|
273
287
|
[alias] = resolved["aliases"]
|
|
@@ -307,7 +321,7 @@ def mk_actions(collection_id: str, processed_items: List[Item]):
|
|
|
307
321
|
"""
|
|
308
322
|
return [
|
|
309
323
|
{
|
|
310
|
-
"_index":
|
|
324
|
+
"_index": index_alias_by_collection_id(collection_id),
|
|
311
325
|
"_id": mk_item_id(item["id"], item["collection"]),
|
|
312
326
|
"_source": item,
|
|
313
327
|
}
|
|
@@ -476,7 +490,7 @@ class DatabaseLogic:
|
|
|
476
490
|
"""
|
|
477
491
|
try:
|
|
478
492
|
item = await self.client.get(
|
|
479
|
-
index=
|
|
493
|
+
index=index_alias_by_collection_id(collection_id),
|
|
480
494
|
id=mk_item_id(item_id, collection_id),
|
|
481
495
|
)
|
|
482
496
|
except exceptions.NotFoundError:
|
|
@@ -838,7 +852,7 @@ class DatabaseLogic:
|
|
|
838
852
|
await self.check_collection_exists(collection_id=item["collection"])
|
|
839
853
|
|
|
840
854
|
if not exist_ok and await self.client.exists(
|
|
841
|
-
index=
|
|
855
|
+
index=index_alias_by_collection_id(item["collection"]),
|
|
842
856
|
id=mk_item_id(item["id"], item["collection"]),
|
|
843
857
|
):
|
|
844
858
|
raise ConflictError(
|
|
@@ -875,7 +889,7 @@ class DatabaseLogic:
|
|
|
875
889
|
raise NotFoundError(f"Collection {collection_id} does not exist")
|
|
876
890
|
|
|
877
891
|
if not exist_ok and self.sync_client.exists(
|
|
878
|
-
index=
|
|
892
|
+
index=index_alias_by_collection_id(collection_id),
|
|
879
893
|
id=mk_item_id(item_id, collection_id),
|
|
880
894
|
):
|
|
881
895
|
raise ConflictError(
|
|
@@ -901,7 +915,7 @@ class DatabaseLogic:
|
|
|
901
915
|
item_id = item["id"]
|
|
902
916
|
collection_id = item["collection"]
|
|
903
917
|
es_resp = await self.client.index(
|
|
904
|
-
index=
|
|
918
|
+
index=index_alias_by_collection_id(collection_id),
|
|
905
919
|
id=mk_item_id(item_id, collection_id),
|
|
906
920
|
body=item,
|
|
907
921
|
refresh=refresh,
|
|
@@ -927,7 +941,7 @@ class DatabaseLogic:
|
|
|
927
941
|
"""
|
|
928
942
|
try:
|
|
929
943
|
await self.client.delete(
|
|
930
|
-
index=
|
|
944
|
+
index=index_alias_by_collection_id(collection_id),
|
|
931
945
|
id=mk_item_id(item_id, collection_id),
|
|
932
946
|
refresh=refresh,
|
|
933
947
|
)
|
{stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/stac_fastapi/opensearch/version.py
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""library version."""
|
|
2
|
-
__version__ = "3.2.
|
|
2
|
+
__version__ = "3.2.4"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: stac-fastapi.opensearch
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.4
|
|
4
4
|
Summary: Opensearch stac-fastapi backend.
|
|
5
5
|
Home-page: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch
|
|
6
6
|
License: MIT
|
|
@@ -12,6 +12,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
16
|
Classifier: License :: OSI Approved :: MIT License
|
|
16
17
|
Requires-Python: >=3.8
|
|
17
18
|
Description-Content-Type: text/markdown
|
|
@@ -288,17 +289,17 @@ A reindex operation might be useful to apply changes to documents or to correct
|
|
|
288
289
|
|
|
289
290
|
The index templates will make sure that manually created indices will also have the correct mappings and settings.
|
|
290
291
|
|
|
291
|
-
In this example, we will make a copy of an existing Item index `items_my-collection-000001` but change the Item identifier to be lowercase.
|
|
292
|
+
In this example, we will make a copy of an existing Item index `items_my-collection-lower_my-collection-hex-000001` but change the Item identifier to be lowercase.
|
|
292
293
|
|
|
293
294
|
```shell
|
|
294
295
|
curl -X "POST" "http://localhost:9200/_reindex" \
|
|
295
296
|
-H 'Content-Type: application/json' \
|
|
296
297
|
-d $'{
|
|
297
298
|
"source": {
|
|
298
|
-
"index": "items_my-collection-000001"
|
|
299
|
+
"index": "items_my-collection-lower_my-collection-hex-000001"
|
|
299
300
|
},
|
|
300
301
|
"dest": {
|
|
301
|
-
"index": "items_my-collection-000002"
|
|
302
|
+
"index": "items_my-collection-lower_my-collection-hex-000002"
|
|
302
303
|
},
|
|
303
304
|
"script": {
|
|
304
305
|
"source": "ctx._source.id = ctx._source.id.toLowerCase()",
|
|
@@ -307,7 +308,7 @@ curl -X "POST" "http://localhost:9200/_reindex" \
|
|
|
307
308
|
}'
|
|
308
309
|
```
|
|
309
310
|
|
|
310
|
-
If we are happy with the data in the newly created index, we can move the alias `items_my-collection` to the new index `items_my-collection-000002`.
|
|
311
|
+
If we are happy with the data in the newly created index, we can move the alias `items_my-collection` to the new index `items_my-collection-lower_my-collection-hex-000002`.
|
|
311
312
|
```shell
|
|
312
313
|
curl -X "POST" "http://localhost:9200/_aliases" \
|
|
313
314
|
-h 'Content-Type: application/json' \
|
|
@@ -321,7 +322,7 @@ curl -X "POST" "http://localhost:9200/_aliases" \
|
|
|
321
322
|
},
|
|
322
323
|
{
|
|
323
324
|
"add": {
|
|
324
|
-
"index": "items_my-collection-000002",
|
|
325
|
+
"index": "items_my-collection-lower_my-collection-hex-000002",
|
|
325
326
|
"alias": "items_my-collection"
|
|
326
327
|
}
|
|
327
328
|
}
|
|
@@ -338,7 +339,7 @@ Authentication is an optional feature that can be enabled through `Route Depende
|
|
|
338
339
|
|
|
339
340
|
## Aggregation
|
|
340
341
|
|
|
341
|
-
Aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates is supported in stac-fatsapi-elasticsearch-opensearch. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). Details for supported aggregations can be found
|
|
342
|
+
Aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates is supported in stac-fatsapi-elasticsearch-opensearch. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). Details for supported aggregations can be found in [the aggregation docs](./docs/src/aggregation.md)
|
|
342
343
|
|
|
343
344
|
## Rate Limiting
|
|
344
345
|
|
|
File without changes
|
{stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/stac_fastapi/opensearch/__init__.py
RENAMED
|
File without changes
|
{stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/stac_fastapi/opensearch/app.py
RENAMED
|
File without changes
|
{stac_fastapi.opensearch-3.2.2 → stac_fastapi.opensearch-3.2.4}/stac_fastapi/opensearch/config.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|