stac-fastapi-opensearch 6.2.0__py3-none-any.whl → 6.3.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.
- stac_fastapi/opensearch/app.py +31 -3
- stac_fastapi/opensearch/database_logic.py +8 -4
- stac_fastapi/opensearch/version.py +1 -1
- {stac_fastapi_opensearch-6.2.0.dist-info → stac_fastapi_opensearch-6.3.0.dist-info}/METADATA +43 -23
- stac_fastapi_opensearch-6.3.0.dist-info/RECORD +10 -0
- stac_fastapi_opensearch-6.2.0.dist-info/RECORD +0 -10
- {stac_fastapi_opensearch-6.2.0.dist-info → stac_fastapi_opensearch-6.3.0.dist-info}/WHEEL +0 -0
- {stac_fastapi_opensearch-6.2.0.dist-info → stac_fastapi_opensearch-6.3.0.dist-info}/entry_points.txt +0 -0
- {stac_fastapi_opensearch-6.2.0.dist-info → stac_fastapi_opensearch-6.3.0.dist-info}/top_level.txt +0 -0
stac_fastapi/opensearch/app.py
CHANGED
|
@@ -7,7 +7,12 @@ from contextlib import asynccontextmanager
|
|
|
7
7
|
from fastapi import FastAPI
|
|
8
8
|
|
|
9
9
|
from stac_fastapi.api.app import StacApi
|
|
10
|
-
from stac_fastapi.api.models import
|
|
10
|
+
from stac_fastapi.api.models import (
|
|
11
|
+
ItemCollectionUri,
|
|
12
|
+
create_get_request_model,
|
|
13
|
+
create_post_request_model,
|
|
14
|
+
create_request_model,
|
|
15
|
+
)
|
|
11
16
|
from stac_fastapi.core.core import (
|
|
12
17
|
BulkTransactionsClient,
|
|
13
18
|
CoreClient,
|
|
@@ -32,7 +37,10 @@ from stac_fastapi.extensions.core import (
|
|
|
32
37
|
TokenPaginationExtension,
|
|
33
38
|
TransactionExtension,
|
|
34
39
|
)
|
|
40
|
+
from stac_fastapi.extensions.core.fields import FieldsConformanceClasses
|
|
35
41
|
from stac_fastapi.extensions.core.filter import FilterConformanceClasses
|
|
42
|
+
from stac_fastapi.extensions.core.query import QueryConformanceClasses
|
|
43
|
+
from stac_fastapi.extensions.core.sort import SortConformanceClasses
|
|
36
44
|
from stac_fastapi.extensions.third_party import BulkTransactionExtension
|
|
37
45
|
from stac_fastapi.opensearch.config import OpensearchSettings
|
|
38
46
|
from stac_fastapi.opensearch.database_logic import (
|
|
@@ -77,8 +85,11 @@ aggregation_extension = AggregationExtension(
|
|
|
77
85
|
aggregation_extension.POST = EsAggregationExtensionPostRequest
|
|
78
86
|
aggregation_extension.GET = EsAggregationExtensionGetRequest
|
|
79
87
|
|
|
88
|
+
fields_extension = FieldsExtension()
|
|
89
|
+
fields_extension.conformance_classes.append(FieldsConformanceClasses.ITEMS)
|
|
90
|
+
|
|
80
91
|
search_extensions = [
|
|
81
|
-
|
|
92
|
+
fields_extension,
|
|
82
93
|
QueryExtension(),
|
|
83
94
|
SortExtension(),
|
|
84
95
|
TokenPaginationExtension(),
|
|
@@ -115,10 +126,26 @@ database_logic.extensions = [type(ext).__name__ for ext in extensions]
|
|
|
115
126
|
|
|
116
127
|
post_request_model = create_post_request_model(search_extensions)
|
|
117
128
|
|
|
129
|
+
items_get_request_model = create_request_model(
|
|
130
|
+
model_name="ItemCollectionUri",
|
|
131
|
+
base_model=ItemCollectionUri,
|
|
132
|
+
extensions=[
|
|
133
|
+
SortExtension(
|
|
134
|
+
conformance_classes=[SortConformanceClasses.ITEMS],
|
|
135
|
+
),
|
|
136
|
+
QueryExtension(
|
|
137
|
+
conformance_classes=[QueryConformanceClasses.ITEMS],
|
|
138
|
+
),
|
|
139
|
+
filter_extension,
|
|
140
|
+
FieldsExtension(conformance_classes=[FieldsConformanceClasses.ITEMS]),
|
|
141
|
+
],
|
|
142
|
+
request_type="GET",
|
|
143
|
+
)
|
|
144
|
+
|
|
118
145
|
app_config = {
|
|
119
146
|
"title": os.getenv("STAC_FASTAPI_TITLE", "stac-fastapi-opensearch"),
|
|
120
147
|
"description": os.getenv("STAC_FASTAPI_DESCRIPTION", "stac-fastapi-opensearch"),
|
|
121
|
-
"api_version": os.getenv("STAC_FASTAPI_VERSION", "6.
|
|
148
|
+
"api_version": os.getenv("STAC_FASTAPI_VERSION", "6.0.0"),
|
|
122
149
|
"settings": settings,
|
|
123
150
|
"extensions": extensions,
|
|
124
151
|
"client": CoreClient(
|
|
@@ -129,6 +156,7 @@ app_config = {
|
|
|
129
156
|
),
|
|
130
157
|
"search_get_request_model": create_get_request_model(search_extensions),
|
|
131
158
|
"search_post_request_model": post_request_model,
|
|
159
|
+
"items_get_request_model": items_get_request_model,
|
|
132
160
|
"route_dependencies": get_route_dependencies(),
|
|
133
161
|
}
|
|
134
162
|
|
|
@@ -16,7 +16,7 @@ from starlette.requests import Request
|
|
|
16
16
|
|
|
17
17
|
from stac_fastapi.core.base_database_logic import BaseDatabaseLogic
|
|
18
18
|
from stac_fastapi.core.serializers import CollectionSerializer, ItemSerializer
|
|
19
|
-
from stac_fastapi.core.utilities import
|
|
19
|
+
from stac_fastapi.core.utilities import bbox2polygon, get_max_limit
|
|
20
20
|
from stac_fastapi.extensions.core.transaction.request import (
|
|
21
21
|
PartialCollection,
|
|
22
22
|
PartialItem,
|
|
@@ -540,7 +540,7 @@ class DatabaseLogic(BaseDatabaseLogic):
|
|
|
540
540
|
|
|
541
541
|
search_body["sort"] = sort if sort else DEFAULT_SORT
|
|
542
542
|
|
|
543
|
-
max_result_window =
|
|
543
|
+
max_result_window = get_max_limit()
|
|
544
544
|
|
|
545
545
|
size_limit = min(limit + 1, max_result_window)
|
|
546
546
|
|
|
@@ -869,6 +869,7 @@ class DatabaseLogic(BaseDatabaseLogic):
|
|
|
869
869
|
item_id=item_id,
|
|
870
870
|
operations=operations,
|
|
871
871
|
base_url=base_url,
|
|
872
|
+
create_nest=True,
|
|
872
873
|
refresh=refresh,
|
|
873
874
|
)
|
|
874
875
|
|
|
@@ -878,6 +879,7 @@ class DatabaseLogic(BaseDatabaseLogic):
|
|
|
878
879
|
item_id: str,
|
|
879
880
|
operations: List[PatchOperation],
|
|
880
881
|
base_url: str,
|
|
882
|
+
create_nest: bool = False,
|
|
881
883
|
refresh: bool = True,
|
|
882
884
|
) -> Item:
|
|
883
885
|
"""Database logic for json patching an item following RF6902.
|
|
@@ -912,7 +914,7 @@ class DatabaseLogic(BaseDatabaseLogic):
|
|
|
912
914
|
else:
|
|
913
915
|
script_operations.append(operation)
|
|
914
916
|
|
|
915
|
-
script = operations_to_script(script_operations)
|
|
917
|
+
script = operations_to_script(script_operations, create_nest=create_nest)
|
|
916
918
|
|
|
917
919
|
try:
|
|
918
920
|
search_response = await self.client.search(
|
|
@@ -1220,6 +1222,7 @@ class DatabaseLogic(BaseDatabaseLogic):
|
|
|
1220
1222
|
collection_id=collection_id,
|
|
1221
1223
|
operations=operations,
|
|
1222
1224
|
base_url=base_url,
|
|
1225
|
+
create_nest=True,
|
|
1223
1226
|
refresh=refresh,
|
|
1224
1227
|
)
|
|
1225
1228
|
|
|
@@ -1228,6 +1231,7 @@ class DatabaseLogic(BaseDatabaseLogic):
|
|
|
1228
1231
|
collection_id: str,
|
|
1229
1232
|
operations: List[PatchOperation],
|
|
1230
1233
|
base_url: str,
|
|
1234
|
+
create_nest: bool = False,
|
|
1231
1235
|
refresh: bool = True,
|
|
1232
1236
|
) -> Collection:
|
|
1233
1237
|
"""Database logic for json patching a collection following RF6902.
|
|
@@ -1255,7 +1259,7 @@ class DatabaseLogic(BaseDatabaseLogic):
|
|
|
1255
1259
|
else:
|
|
1256
1260
|
script_operations.append(operation)
|
|
1257
1261
|
|
|
1258
|
-
script = operations_to_script(script_operations)
|
|
1262
|
+
script = operations_to_script(script_operations, create_nest=create_nest)
|
|
1259
1263
|
|
|
1260
1264
|
try:
|
|
1261
1265
|
await self.client.update(
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""library version."""
|
|
2
|
-
__version__ = "6.
|
|
2
|
+
__version__ = "6.3.0"
|
{stac_fastapi_opensearch-6.2.0.dist-info → stac_fastapi_opensearch-6.3.0.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: stac-fastapi-opensearch
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.3.0
|
|
4
4
|
Summary: Opensearch stac-fastapi backend.
|
|
5
5
|
Home-page: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch
|
|
6
6
|
License: MIT
|
|
@@ -15,8 +15,8 @@ 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.
|
|
19
|
-
Requires-Dist: sfeos-helpers==6.
|
|
18
|
+
Requires-Dist: stac-fastapi-core==6.3.0
|
|
19
|
+
Requires-Dist: sfeos-helpers==6.3.0
|
|
20
20
|
Requires-Dist: opensearch-py~=2.8.0
|
|
21
21
|
Requires-Dist: opensearch-py[async]~=2.8.0
|
|
22
22
|
Requires-Dist: uvicorn~=0.23.0
|
|
@@ -103,26 +103,43 @@ This project is built on the following technologies: STAC, stac-fastapi, FastAPI
|
|
|
103
103
|
|
|
104
104
|
## Table of Contents
|
|
105
105
|
|
|
106
|
-
- [
|
|
107
|
-
- [
|
|
108
|
-
- [
|
|
109
|
-
- [
|
|
110
|
-
- [
|
|
111
|
-
- [
|
|
112
|
-
- [
|
|
113
|
-
- [
|
|
114
|
-
- [
|
|
115
|
-
- [
|
|
116
|
-
- [
|
|
117
|
-
- [
|
|
118
|
-
- [
|
|
119
|
-
- [
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
- [
|
|
123
|
-
- [
|
|
124
|
-
- [
|
|
125
|
-
- [
|
|
106
|
+
- [stac-fastapi-elasticsearch-opensearch](#stac-fastapi-elasticsearch-opensearch)
|
|
107
|
+
- [Sponsors \& Supporters](#sponsors--supporters)
|
|
108
|
+
- [Project Introduction - What is SFEOS?](#project-introduction---what-is-sfeos)
|
|
109
|
+
- [Common Deployment Patterns](#common-deployment-patterns)
|
|
110
|
+
- [Technologies](#technologies)
|
|
111
|
+
- [Table of Contents](#table-of-contents)
|
|
112
|
+
- [Documentation \& Resources](#documentation--resources)
|
|
113
|
+
- [Package Structure](#package-structure)
|
|
114
|
+
- [Examples](#examples)
|
|
115
|
+
- [Performance](#performance)
|
|
116
|
+
- [Direct Response Mode](#direct-response-mode)
|
|
117
|
+
- [Quick Start](#quick-start)
|
|
118
|
+
- [Installation](#installation)
|
|
119
|
+
- [Running Locally](#running-locally)
|
|
120
|
+
- [Using Pre-built Docker Images](#using-pre-built-docker-images)
|
|
121
|
+
- [Using Docker Compose](#using-docker-compose)
|
|
122
|
+
- [Configuration Reference](#configuration-reference)
|
|
123
|
+
- [Datetime-Based Index Management](#datetime-based-index-management)
|
|
124
|
+
- [Overview](#overview)
|
|
125
|
+
- [When to Use](#when-to-use)
|
|
126
|
+
- [Configuration](#configuration)
|
|
127
|
+
- [Enabling Datetime-Based Indexing](#enabling-datetime-based-indexing)
|
|
128
|
+
- [Related Configuration Variables](#related-configuration-variables)
|
|
129
|
+
- [How Datetime-Based Indexing Works](#how-datetime-based-indexing-works)
|
|
130
|
+
- [Index and Alias Naming Convention](#index-and-alias-naming-convention)
|
|
131
|
+
- [Index Size Management](#index-size-management)
|
|
132
|
+
- [Interacting with the API](#interacting-with-the-api)
|
|
133
|
+
- [Configure the API](#configure-the-api)
|
|
134
|
+
- [Collection Pagination](#collection-pagination)
|
|
135
|
+
- [Ingesting Sample Data CLI Tool](#ingesting-sample-data-cli-tool)
|
|
136
|
+
- [Elasticsearch Mappings](#elasticsearch-mappings)
|
|
137
|
+
- [Managing Elasticsearch Indices](#managing-elasticsearch-indices)
|
|
138
|
+
- [Snapshots](#snapshots)
|
|
139
|
+
- [Reindexing](#reindexing)
|
|
140
|
+
- [Auth](#auth)
|
|
141
|
+
- [Aggregation](#aggregation)
|
|
142
|
+
- [Rate Limiting](#rate-limiting)
|
|
126
143
|
|
|
127
144
|
## Documentation & Resources
|
|
128
145
|
|
|
@@ -264,6 +281,9 @@ You can customize additional settings in your `.env` file:
|
|
|
264
281
|
| `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 |
|
|
265
282
|
| `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 |
|
|
266
283
|
| `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 |
|
|
284
|
+
| `STAC_ITEM_LIMIT` | Sets the environment variable for result limiting to SFEOS for the number of returned items and STAC collections. | `10` | Optional |
|
|
285
|
+
| `STAC_INDEX_ASSETS` | Controls if Assets are indexed when added to Elasticsearch/Opensearch. This allows asset fields to be included in search queries. | `false` | Optional |
|
|
286
|
+
| `ENV_MAX_LIMIT` | Configures the environment variable in SFEOS to override the default `MAX_LIMIT`, which controls the limit parameter for returned items and STAC collections. | `10,000` | Optional |
|
|
267
287
|
|
|
268
288
|
> [!NOTE]
|
|
269
289
|
> 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.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
stac_fastapi/opensearch/__init__.py,sha256=iJWMUgn7mUvmuPQSO_FlyhJ5eDdbbfmGv1qnFOX5-qk,28
|
|
2
|
+
stac_fastapi/opensearch/app.py,sha256=KTXD2jdAlcrrXr1o0bRMFBJp-B3fo0F3gyY2Pcc9rMA,6558
|
|
3
|
+
stac_fastapi/opensearch/config.py,sha256=zGx4-4c5zEnu_Bh8Ra3SkIC83tluDiz-wKYQclRRDJA,5179
|
|
4
|
+
stac_fastapi/opensearch/database_logic.py,sha256=jvFsyQYmFTYkakVg6kcQt1zx-IkqmCC2093gtgNwuPQ,56024
|
|
5
|
+
stac_fastapi/opensearch/version.py,sha256=rBLPQyvMDNA0PA0jXfByTouJPJn5p0wXiqmUWJMIfYc,45
|
|
6
|
+
stac_fastapi_opensearch-6.3.0.dist-info/METADATA,sha256=B-xB5wIjNHXI9bkk5Oeg6wuK69j8nE-p529wXq8oIcw,36590
|
|
7
|
+
stac_fastapi_opensearch-6.3.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
8
|
+
stac_fastapi_opensearch-6.3.0.dist-info/entry_points.txt,sha256=zjZ0Xsr9BUNJqMkdPpl6zEIUykv1uFdJtNELFRChp0w,76
|
|
9
|
+
stac_fastapi_opensearch-6.3.0.dist-info/top_level.txt,sha256=vqn-D9-HsRPTTxy0Vk_KkDmTiMES4owwBQ3ydSZYb2s,13
|
|
10
|
+
stac_fastapi_opensearch-6.3.0.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
stac_fastapi/opensearch/__init__.py,sha256=iJWMUgn7mUvmuPQSO_FlyhJ5eDdbbfmGv1qnFOX5-qk,28
|
|
2
|
-
stac_fastapi/opensearch/app.py,sha256=WHo0C9c4EvNUW8l_2eiNu2yLPGe23RfHdu_F9-deoL0,5642
|
|
3
|
-
stac_fastapi/opensearch/config.py,sha256=zGx4-4c5zEnu_Bh8Ra3SkIC83tluDiz-wKYQclRRDJA,5179
|
|
4
|
-
stac_fastapi/opensearch/database_logic.py,sha256=0NzzWZqxrgZ-zcxqBcypOXeuFqf5EYia91za9NHepzY,55834
|
|
5
|
-
stac_fastapi/opensearch/version.py,sha256=ro2d3oERQL2KxSo7qmbU0z6qT77XShwY6vsqrLf2VFw,45
|
|
6
|
-
stac_fastapi_opensearch-6.2.0.dist-info/METADATA,sha256=0YnHUYtuSPuibokLp7ToJsEw4v9gIKbUoALnSchZuak,35019
|
|
7
|
-
stac_fastapi_opensearch-6.2.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
8
|
-
stac_fastapi_opensearch-6.2.0.dist-info/entry_points.txt,sha256=zjZ0Xsr9BUNJqMkdPpl6zEIUykv1uFdJtNELFRChp0w,76
|
|
9
|
-
stac_fastapi_opensearch-6.2.0.dist-info/top_level.txt,sha256=vqn-D9-HsRPTTxy0Vk_KkDmTiMES4owwBQ3ydSZYb2s,13
|
|
10
|
-
stac_fastapi_opensearch-6.2.0.dist-info/RECORD,,
|
|
File without changes
|
{stac_fastapi_opensearch-6.2.0.dist-info → stac_fastapi_opensearch-6.3.0.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{stac_fastapi_opensearch-6.2.0.dist-info → stac_fastapi_opensearch-6.3.0.dist-info}/top_level.txt
RENAMED
|
File without changes
|