sfeos-helpers 6.0.0__py3-none-any.whl → 6.1.0__py3-none-any.whl
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.
- {sfeos_helpers-6.0.0.dist-info → sfeos_helpers-6.1.0.dist-info}/METADATA +16 -14
- {sfeos_helpers-6.0.0.dist-info → sfeos_helpers-6.1.0.dist-info}/RECORD +6 -6
- stac_fastapi/sfeos_helpers/database/query.py +32 -0
- stac_fastapi/sfeos_helpers/version.py +1 -1
- {sfeos_helpers-6.0.0.dist-info → sfeos_helpers-6.1.0.dist-info}/WHEEL +0 -0
- {sfeos_helpers-6.0.0.dist-info → sfeos_helpers-6.1.0.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sfeos-helpers
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.1.0
|
|
4
4
|
Summary: Helper library for the Elasticsearch and Opensearch stac-fastapi backends.
|
|
5
5
|
Home-page: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch
|
|
6
6
|
License: MIT
|
|
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
15
15
|
Classifier: License :: OSI Approved :: MIT License
|
|
16
16
|
Requires-Python: >=3.9
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
|
-
Requires-Dist: stac-fastapi.core==6.
|
|
18
|
+
Requires-Dist: stac-fastapi.core==6.1.0
|
|
19
19
|
|
|
20
20
|
# stac-fastapi-elasticsearch-opensearch
|
|
21
21
|
|
|
@@ -34,7 +34,7 @@ Requires-Dist: stac-fastapi.core==6.0.0
|
|
|
34
34
|
[](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/network/members)
|
|
35
35
|
[](https://pypi.org/project/stac-fastapi-elasticsearch/)
|
|
36
36
|
[](https://github.com/radiantearth/stac-spec/tree/v1.1.0)
|
|
37
|
-
[](https://github.com/stac-utils/stac-fastapi)
|
|
38
38
|
|
|
39
39
|
## Sponsors & Supporters
|
|
40
40
|
|
|
@@ -224,28 +224,30 @@ You can customize additional settings in your `.env` file:
|
|
|
224
224
|
|------------------------------|--------------------------------------------------------------------------------------|--------------------------|---------------------------------------------------------------------------------------------|
|
|
225
225
|
| `ES_HOST` | Hostname for external Elasticsearch/OpenSearch. | `localhost` | Optional |
|
|
226
226
|
| `ES_PORT` | Port for Elasticsearch/OpenSearch. | `9200` (ES) / `9202` (OS)| Optional |
|
|
227
|
-
| `ES_USE_SSL` | Use SSL for connecting to Elasticsearch/OpenSearch. | `
|
|
228
|
-
| `ES_VERIFY_CERTS` | Verify SSL certificates when connecting. | `
|
|
227
|
+
| `ES_USE_SSL` | Use SSL for connecting to Elasticsearch/OpenSearch. | `true` | Optional |
|
|
228
|
+
| `ES_VERIFY_CERTS` | Verify SSL certificates when connecting. | `true` | Optional |
|
|
229
|
+
| `ES_API_KEY` | API Key for external Elasticsearch/OpenSearch. | N/A | Optional |
|
|
230
|
+
| `ES_TIMEOUT` | Client timeout for Elasticsearch/OpenSearch. | DB client default | Optional |
|
|
229
231
|
| `STAC_FASTAPI_TITLE` | Title of the API in the documentation. | `stac-fastapi-<backend>` | Optional |
|
|
230
232
|
| `STAC_FASTAPI_DESCRIPTION` | Description of the API in the documentation. | N/A | Optional |
|
|
231
233
|
| `STAC_FASTAPI_VERSION` | API version. | `2.1` | Optional |
|
|
232
|
-
| `STAC_FASTAPI_LANDING_PAGE_ID` | Landing page ID
|
|
234
|
+
| `STAC_FASTAPI_LANDING_PAGE_ID` | Landing page ID | `stac-fastapi` | Optional |
|
|
233
235
|
| `APP_HOST` | Server bind address. | `0.0.0.0` | Optional |
|
|
234
|
-
| `APP_PORT` | Server port. | `
|
|
236
|
+
| `APP_PORT` | Server port. | `8000` | Optional |
|
|
235
237
|
| `ENVIRONMENT` | Runtime environment. | `local` | Optional |
|
|
236
238
|
| `WEB_CONCURRENCY` | Number of worker processes. | `10` | Optional |
|
|
237
239
|
| `RELOAD` | Enable auto-reload for development. | `true` | Optional |
|
|
238
240
|
| `STAC_FASTAPI_RATE_LIMIT` | API rate limit per client. | `200/minute` | Optional |
|
|
239
|
-
| `BACKEND` | Tests-related variable | `elasticsearch` or `opensearch` based on the backend | Optional
|
|
240
|
-
| `ELASTICSEARCH_VERSION`
|
|
241
|
-
| `OPENSEARCH_VERSION` | OpenSearch version | `2.11.1` | Optional
|
|
242
|
-
| `ENABLE_DIRECT_RESPONSE`
|
|
243
|
-
| `RAISE_ON_BULK_ERROR`
|
|
244
|
-
| `DATABASE_REFRESH`
|
|
241
|
+
| `BACKEND` | Tests-related variable | `elasticsearch` or `opensearch` based on the backend | Optional |
|
|
242
|
+
| `ELASTICSEARCH_VERSION` | Version of Elasticsearch to use. | `8.11.0` | Optional |
|
|
243
|
+
| `OPENSEARCH_VERSION` | OpenSearch version | `2.11.1` | Optional |
|
|
244
|
+
| `ENABLE_DIRECT_RESPONSE` | Enable direct response for maximum performance (disables all FastAPI dependencies, including authentication, custom status codes, and validation) | `false` | Optional |
|
|
245
|
+
| `RAISE_ON_BULK_ERROR` | Controls whether bulk insert operations raise exceptions on errors. If set to `true`, the operation will stop and raise an exception when an error occurs. If set to `false`, errors will be logged, and the operation will continue. **Note:** STAC Item and ItemCollection validation errors will always raise, regardless of this flag. | `false` | Optional |
|
|
246
|
+
| `DATABASE_REFRESH` | Controls whether database operations refresh the index immediately after changes. If set to `true`, changes will be immediately searchable. If set to `false`, changes may not be immediately visible but can improve performance for bulk operations. If set to `wait_for`, changes will wait for the next refresh cycle to become visible. | `false` | Optional |
|
|
245
247
|
| `ENABLE_TRANSACTIONS_EXTENSIONS` | Enables or disables the Transactions and Bulk Transactions API extensions. If set to `false`, the POST `/collections` route and related transaction endpoints (including bulk transaction operations) will be unavailable in the API. This is useful for deployments where mutating the catalog via the API should be prevented. | `true` | Optional |
|
|
246
248
|
|
|
247
249
|
> [!NOTE]
|
|
248
|
-
> The variables `ES_HOST`, `ES_PORT`, `ES_USE_SSL`, and `
|
|
250
|
+
> The variables `ES_HOST`, `ES_PORT`, `ES_USE_SSL`, `ES_VERIFY_CERTS` and `ES_TIMEOUT` apply to both Elasticsearch and OpenSearch backends, so there is no need to rename the key names to `OS_` even if you're using OpenSearch.
|
|
249
251
|
|
|
250
252
|
## Interacting with the API
|
|
251
253
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
stac_fastapi/sfeos_helpers/mappings.py,sha256=z6GJFJUE7bRKF9ODc8_ddkb7JCOokMtj4p2LeaQqrQQ,8237
|
|
2
|
-
stac_fastapi/sfeos_helpers/version.py,sha256=
|
|
2
|
+
stac_fastapi/sfeos_helpers/version.py,sha256=7IrY7mbr0cGVqZsk6wmCeITxZjDgz_mPHUswrziX5ME,45
|
|
3
3
|
stac_fastapi/sfeos_helpers/aggregation/__init__.py,sha256=Mym17lFh90by1GnoQgMyIKAqRNJnvCgVSXDYzjBiPQk,1210
|
|
4
4
|
stac_fastapi/sfeos_helpers/aggregation/client.py,sha256=JCUVBXsUXHdUXn59WaytGxB-R6OLhC_LApPm-pzQNTI,17818
|
|
5
5
|
stac_fastapi/sfeos_helpers/aggregation/format.py,sha256=qUW1jjh2EEjy-V7riliFR77grpi-AgsTmP76z60K5Lo,2011
|
|
@@ -8,14 +8,14 @@ stac_fastapi/sfeos_helpers/database/datetime.py,sha256=L_bY0EtRi6b8XIN9zcHbFe-O2
|
|
|
8
8
|
stac_fastapi/sfeos_helpers/database/document.py,sha256=LtjX15gvaOuZC_k2t_oQhys_c-zRTLN5rwX0hNJkHnM,1725
|
|
9
9
|
stac_fastapi/sfeos_helpers/database/index.py,sha256=7xFNzOQzFxBAtQUKUmhKcqz5j3_HRPuwIecdEEWb0i0,4476
|
|
10
10
|
stac_fastapi/sfeos_helpers/database/mapping.py,sha256=4-MSd4xH5wg7yoC4aPjzYMDSEvP026bw4k2TfffMT5E,1387
|
|
11
|
-
stac_fastapi/sfeos_helpers/database/query.py,sha256=
|
|
11
|
+
stac_fastapi/sfeos_helpers/database/query.py,sha256=k6aS20gnnjJzDynJ2AaPstpAPXEeWUEbPSkDffOf2To,4001
|
|
12
12
|
stac_fastapi/sfeos_helpers/database/utils.py,sha256=nPTWqP-pdSZumeYRx92XTN4xmmufRSqCDHaiSLdg-3o,7311
|
|
13
13
|
stac_fastapi/sfeos_helpers/filter/__init__.py,sha256=n3zL_MhEGOoxMz1KeijyK_UKiZ0MKPl90zHtYI5RAy8,1557
|
|
14
14
|
stac_fastapi/sfeos_helpers/filter/client.py,sha256=QwjYWXkevoVS7HPtoXfeSzDy-_GJnFhPJtJM49D14oU,4229
|
|
15
15
|
stac_fastapi/sfeos_helpers/filter/cql2.py,sha256=Cg9kRYD9CVkVSyRqOyB5oVXmlyteSn2bw88sqklGpUM,955
|
|
16
16
|
stac_fastapi/sfeos_helpers/filter/transform.py,sha256=1GEWQSp-rbq7_1nDVv1ApDbWxt8DswJWxwaxzV85gj4,4644
|
|
17
17
|
stac_fastapi/sfeos_helpers/models/patch.py,sha256=akzfF7vXI6AyGDrxgP8KqVwBvBDQayXYNNf4pm6Q8qM,4209
|
|
18
|
-
sfeos_helpers-6.
|
|
19
|
-
sfeos_helpers-6.
|
|
20
|
-
sfeos_helpers-6.
|
|
21
|
-
sfeos_helpers-6.
|
|
18
|
+
sfeos_helpers-6.1.0.dist-info/METADATA,sha256=s1LnfR02D7oP7eSCbGsk8insjjKFZx4V5GVXC182XUo,31528
|
|
19
|
+
sfeos_helpers-6.1.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
20
|
+
sfeos_helpers-6.1.0.dist-info/top_level.txt,sha256=vqn-D9-HsRPTTxy0Vk_KkDmTiMES4owwBQ3ydSZYb2s,13
|
|
21
|
+
sfeos_helpers-6.1.0.dist-info/RECORD,,
|
|
@@ -7,6 +7,8 @@ from typing import Any, Dict, List, Optional
|
|
|
7
7
|
|
|
8
8
|
from stac_fastapi.sfeos_helpers.mappings import Geometry
|
|
9
9
|
|
|
10
|
+
ES_MAX_URL_LENGTH = 4096
|
|
11
|
+
|
|
10
12
|
|
|
11
13
|
def apply_free_text_filter_shared(
|
|
12
14
|
search: Any, free_text_queries: Optional[List[str]]
|
|
@@ -83,3 +85,33 @@ def populate_sort_shared(sortby: List) -> Optional[Dict[str, Dict[str, str]]]:
|
|
|
83
85
|
return {s.field: {"order": s.direction} for s in sortby}
|
|
84
86
|
else:
|
|
85
87
|
return None
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def add_collections_to_body(
|
|
91
|
+
collection_ids: List[str], query: Optional[Dict[str, Any]]
|
|
92
|
+
) -> Dict[str, Any]:
|
|
93
|
+
"""Add a list of collection ids to the body of a query.
|
|
94
|
+
|
|
95
|
+
Args:
|
|
96
|
+
collection_ids (List[str]): A list of collections ids.
|
|
97
|
+
query (Optional[Dict[str, Any]]): The query to add collections to. If none, create a query that filters
|
|
98
|
+
the collection ids.
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
Dict[str, Any]: A query that contains a filter on the given collection ids.
|
|
102
|
+
|
|
103
|
+
Notes:
|
|
104
|
+
This function is needed in the execute_search function when the size of the URL path will exceed the maximum of ES.
|
|
105
|
+
"""
|
|
106
|
+
index_filter = {"terms": {"collection": collection_ids}}
|
|
107
|
+
if query is None:
|
|
108
|
+
query = {"query": {}}
|
|
109
|
+
if "bool" not in query:
|
|
110
|
+
query["bool"] = {}
|
|
111
|
+
if "filter" not in query["bool"]:
|
|
112
|
+
query["bool"]["filter"] = []
|
|
113
|
+
|
|
114
|
+
filters = query["bool"]["filter"]
|
|
115
|
+
if index_filter not in filters:
|
|
116
|
+
filters.append(index_filter)
|
|
117
|
+
return query
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""library version."""
|
|
2
|
-
__version__ = "6.
|
|
2
|
+
__version__ = "6.1.0"
|
|
File without changes
|
|
File without changes
|