stac-fastapi-elasticsearch 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/elasticsearch/app.py +32 -3
- stac_fastapi/elasticsearch/database_logic.py +8 -4
- stac_fastapi/elasticsearch/version.py +1 -1
- {stac_fastapi_elasticsearch-6.2.0.dist-info → stac_fastapi_elasticsearch-6.3.0.dist-info}/METADATA +43 -23
- stac_fastapi_elasticsearch-6.3.0.dist-info/RECORD +10 -0
- stac_fastapi_elasticsearch-6.2.0.dist-info/RECORD +0 -10
- {stac_fastapi_elasticsearch-6.2.0.dist-info → stac_fastapi_elasticsearch-6.3.0.dist-info}/WHEEL +0 -0
- {stac_fastapi_elasticsearch-6.2.0.dist-info → stac_fastapi_elasticsearch-6.3.0.dist-info}/entry_points.txt +0 -0
- {stac_fastapi_elasticsearch-6.2.0.dist-info → stac_fastapi_elasticsearch-6.3.0.dist-info}/top_level.txt +0 -0
|
@@ -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,
|
|
@@ -38,7 +43,10 @@ from stac_fastapi.extensions.core import (
|
|
|
38
43
|
TokenPaginationExtension,
|
|
39
44
|
TransactionExtension,
|
|
40
45
|
)
|
|
46
|
+
from stac_fastapi.extensions.core.fields import FieldsConformanceClasses
|
|
41
47
|
from stac_fastapi.extensions.core.filter import FilterConformanceClasses
|
|
48
|
+
from stac_fastapi.extensions.core.query import QueryConformanceClasses
|
|
49
|
+
from stac_fastapi.extensions.core.sort import SortConformanceClasses
|
|
42
50
|
from stac_fastapi.extensions.third_party import BulkTransactionExtension
|
|
43
51
|
from stac_fastapi.sfeos_helpers.aggregation import EsAsyncBaseAggregationClient
|
|
44
52
|
from stac_fastapi.sfeos_helpers.filter import EsAsyncBaseFiltersClient
|
|
@@ -54,6 +62,7 @@ session = Session.create_from_settings(settings)
|
|
|
54
62
|
|
|
55
63
|
database_logic = DatabaseLogic()
|
|
56
64
|
|
|
65
|
+
|
|
57
66
|
filter_extension = FilterExtension(
|
|
58
67
|
client=EsAsyncBaseFiltersClient(database=database_logic)
|
|
59
68
|
)
|
|
@@ -77,8 +86,11 @@ aggregation_extension = AggregationExtension(
|
|
|
77
86
|
aggregation_extension.POST = EsAggregationExtensionPostRequest
|
|
78
87
|
aggregation_extension.GET = EsAggregationExtensionGetRequest
|
|
79
88
|
|
|
89
|
+
fields_extension = FieldsExtension()
|
|
90
|
+
fields_extension.conformance_classes.append(FieldsConformanceClasses.ITEMS)
|
|
91
|
+
|
|
80
92
|
search_extensions = [
|
|
81
|
-
|
|
93
|
+
fields_extension,
|
|
82
94
|
QueryExtension(),
|
|
83
95
|
SortExtension(),
|
|
84
96
|
TokenPaginationExtension(),
|
|
@@ -114,10 +126,26 @@ database_logic.extensions = [type(ext).__name__ for ext in extensions]
|
|
|
114
126
|
|
|
115
127
|
post_request_model = create_post_request_model(search_extensions)
|
|
116
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
|
+
|
|
117
145
|
app_config = {
|
|
118
146
|
"title": os.getenv("STAC_FASTAPI_TITLE", "stac-fastapi-elasticsearch"),
|
|
119
147
|
"description": os.getenv("STAC_FASTAPI_DESCRIPTION", "stac-fastapi-elasticsearch"),
|
|
120
|
-
"api_version": os.getenv("STAC_FASTAPI_VERSION", "6.
|
|
148
|
+
"api_version": os.getenv("STAC_FASTAPI_VERSION", "6.0.0"),
|
|
121
149
|
"settings": settings,
|
|
122
150
|
"extensions": extensions,
|
|
123
151
|
"client": CoreClient(
|
|
@@ -128,6 +156,7 @@ app_config = {
|
|
|
128
156
|
),
|
|
129
157
|
"search_get_request_model": create_get_request_model(search_extensions),
|
|
130
158
|
"search_post_request_model": post_request_model,
|
|
159
|
+
"items_get_request_model": items_get_request_model,
|
|
131
160
|
"route_dependencies": get_route_dependencies(),
|
|
132
161
|
}
|
|
133
162
|
|
|
@@ -17,7 +17,7 @@ from starlette.requests import Request
|
|
|
17
17
|
|
|
18
18
|
from stac_fastapi.core.base_database_logic import BaseDatabaseLogic
|
|
19
19
|
from stac_fastapi.core.serializers import CollectionSerializer, ItemSerializer
|
|
20
|
-
from stac_fastapi.core.utilities import
|
|
20
|
+
from stac_fastapi.core.utilities import bbox2polygon, get_max_limit
|
|
21
21
|
from stac_fastapi.elasticsearch.config import AsyncElasticsearchSettings
|
|
22
22
|
from stac_fastapi.elasticsearch.config import (
|
|
23
23
|
ElasticsearchSettings as SyncElasticsearchSettings,
|
|
@@ -543,7 +543,7 @@ class DatabaseLogic(BaseDatabaseLogic):
|
|
|
543
543
|
index_param = ITEM_INDICES
|
|
544
544
|
query = add_collections_to_body(collection_ids, query)
|
|
545
545
|
|
|
546
|
-
max_result_window =
|
|
546
|
+
max_result_window = get_max_limit()
|
|
547
547
|
|
|
548
548
|
size_limit = min(limit + 1, max_result_window)
|
|
549
549
|
|
|
@@ -886,6 +886,7 @@ class DatabaseLogic(BaseDatabaseLogic):
|
|
|
886
886
|
item_id=item_id,
|
|
887
887
|
operations=operations,
|
|
888
888
|
base_url=base_url,
|
|
889
|
+
create_nest=True,
|
|
889
890
|
refresh=refresh,
|
|
890
891
|
)
|
|
891
892
|
|
|
@@ -895,6 +896,7 @@ class DatabaseLogic(BaseDatabaseLogic):
|
|
|
895
896
|
item_id: str,
|
|
896
897
|
operations: List[PatchOperation],
|
|
897
898
|
base_url: str,
|
|
899
|
+
create_nest: bool = False,
|
|
898
900
|
refresh: bool = True,
|
|
899
901
|
) -> Item:
|
|
900
902
|
"""Database logic for json patching an item following RF6902.
|
|
@@ -929,7 +931,7 @@ class DatabaseLogic(BaseDatabaseLogic):
|
|
|
929
931
|
else:
|
|
930
932
|
script_operations.append(operation)
|
|
931
933
|
|
|
932
|
-
script = operations_to_script(script_operations)
|
|
934
|
+
script = operations_to_script(script_operations, create_nest=create_nest)
|
|
933
935
|
|
|
934
936
|
try:
|
|
935
937
|
search_response = await self.client.search(
|
|
@@ -1265,6 +1267,7 @@ class DatabaseLogic(BaseDatabaseLogic):
|
|
|
1265
1267
|
collection_id=collection_id,
|
|
1266
1268
|
operations=operations,
|
|
1267
1269
|
base_url=base_url,
|
|
1270
|
+
create_nest=True,
|
|
1268
1271
|
refresh=refresh,
|
|
1269
1272
|
)
|
|
1270
1273
|
|
|
@@ -1273,6 +1276,7 @@ class DatabaseLogic(BaseDatabaseLogic):
|
|
|
1273
1276
|
collection_id: str,
|
|
1274
1277
|
operations: List[PatchOperation],
|
|
1275
1278
|
base_url: str,
|
|
1279
|
+
create_nest: bool = False,
|
|
1276
1280
|
refresh: bool = True,
|
|
1277
1281
|
) -> Collection:
|
|
1278
1282
|
"""Database logic for json patching a collection following RF6902.
|
|
@@ -1300,7 +1304,7 @@ class DatabaseLogic(BaseDatabaseLogic):
|
|
|
1300
1304
|
else:
|
|
1301
1305
|
script_operations.append(operation)
|
|
1302
1306
|
|
|
1303
|
-
script = operations_to_script(script_operations)
|
|
1307
|
+
script = operations_to_script(script_operations, create_nest=create_nest)
|
|
1304
1308
|
|
|
1305
1309
|
try:
|
|
1306
1310
|
await self.client.update(
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""library version."""
|
|
2
|
-
__version__ = "6.
|
|
2
|
+
__version__ = "6.3.0"
|
{stac_fastapi_elasticsearch-6.2.0.dist-info → stac_fastapi_elasticsearch-6.3.0.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: stac-fastapi-elasticsearch
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.3.0
|
|
4
4
|
Summary: An implementation of STAC API based on the FastAPI framework with both Elasticsearch and Opensearch.
|
|
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: elasticsearch[async]~=8.18.0
|
|
21
21
|
Requires-Dist: uvicorn~=0.23.0
|
|
22
22
|
Requires-Dist: starlette<0.36.0,>=0.35.0
|
|
@@ -102,26 +102,43 @@ This project is built on the following technologies: STAC, stac-fastapi, FastAPI
|
|
|
102
102
|
|
|
103
103
|
## Table of Contents
|
|
104
104
|
|
|
105
|
-
- [
|
|
106
|
-
- [
|
|
107
|
-
- [
|
|
108
|
-
- [
|
|
109
|
-
- [
|
|
110
|
-
- [
|
|
111
|
-
- [
|
|
112
|
-
- [
|
|
113
|
-
- [
|
|
114
|
-
- [
|
|
115
|
-
- [
|
|
116
|
-
- [
|
|
117
|
-
- [
|
|
118
|
-
- [
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
- [
|
|
122
|
-
- [
|
|
123
|
-
- [
|
|
124
|
-
- [
|
|
105
|
+
- [stac-fastapi-elasticsearch-opensearch](#stac-fastapi-elasticsearch-opensearch)
|
|
106
|
+
- [Sponsors \& Supporters](#sponsors--supporters)
|
|
107
|
+
- [Project Introduction - What is SFEOS?](#project-introduction---what-is-sfeos)
|
|
108
|
+
- [Common Deployment Patterns](#common-deployment-patterns)
|
|
109
|
+
- [Technologies](#technologies)
|
|
110
|
+
- [Table of Contents](#table-of-contents)
|
|
111
|
+
- [Documentation \& Resources](#documentation--resources)
|
|
112
|
+
- [Package Structure](#package-structure)
|
|
113
|
+
- [Examples](#examples)
|
|
114
|
+
- [Performance](#performance)
|
|
115
|
+
- [Direct Response Mode](#direct-response-mode)
|
|
116
|
+
- [Quick Start](#quick-start)
|
|
117
|
+
- [Installation](#installation)
|
|
118
|
+
- [Running Locally](#running-locally)
|
|
119
|
+
- [Using Pre-built Docker Images](#using-pre-built-docker-images)
|
|
120
|
+
- [Using Docker Compose](#using-docker-compose)
|
|
121
|
+
- [Configuration Reference](#configuration-reference)
|
|
122
|
+
- [Datetime-Based Index Management](#datetime-based-index-management)
|
|
123
|
+
- [Overview](#overview)
|
|
124
|
+
- [When to Use](#when-to-use)
|
|
125
|
+
- [Configuration](#configuration)
|
|
126
|
+
- [Enabling Datetime-Based Indexing](#enabling-datetime-based-indexing)
|
|
127
|
+
- [Related Configuration Variables](#related-configuration-variables)
|
|
128
|
+
- [How Datetime-Based Indexing Works](#how-datetime-based-indexing-works)
|
|
129
|
+
- [Index and Alias Naming Convention](#index-and-alias-naming-convention)
|
|
130
|
+
- [Index Size Management](#index-size-management)
|
|
131
|
+
- [Interacting with the API](#interacting-with-the-api)
|
|
132
|
+
- [Configure the API](#configure-the-api)
|
|
133
|
+
- [Collection Pagination](#collection-pagination)
|
|
134
|
+
- [Ingesting Sample Data CLI Tool](#ingesting-sample-data-cli-tool)
|
|
135
|
+
- [Elasticsearch Mappings](#elasticsearch-mappings)
|
|
136
|
+
- [Managing Elasticsearch Indices](#managing-elasticsearch-indices)
|
|
137
|
+
- [Snapshots](#snapshots)
|
|
138
|
+
- [Reindexing](#reindexing)
|
|
139
|
+
- [Auth](#auth)
|
|
140
|
+
- [Aggregation](#aggregation)
|
|
141
|
+
- [Rate Limiting](#rate-limiting)
|
|
125
142
|
|
|
126
143
|
## Documentation & Resources
|
|
127
144
|
|
|
@@ -263,6 +280,9 @@ You can customize additional settings in your `.env` file:
|
|
|
263
280
|
| `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 |
|
|
264
281
|
| `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 |
|
|
265
282
|
| `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 |
|
|
283
|
+
| `STAC_ITEM_LIMIT` | Sets the environment variable for result limiting to SFEOS for the number of returned items and STAC collections. | `10` | Optional |
|
|
284
|
+
| `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 |
|
|
285
|
+
| `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 |
|
|
266
286
|
|
|
267
287
|
> [!NOTE]
|
|
268
288
|
> 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/elasticsearch/__init__.py,sha256=w_MZutYLreNV372sCuO46bPb0TngmPs4u8737ueS0wE,31
|
|
2
|
+
stac_fastapi/elasticsearch/app.py,sha256=42586pNMswKIyC-Q9Lz3hJh88Gm60ibbOsBOpbD0x50,6579
|
|
3
|
+
stac_fastapi/elasticsearch/config.py,sha256=itvPYr4TiOg9pWQrycgGaQxQ_Vc2KKP3aHdtH0OUZvw,5322
|
|
4
|
+
stac_fastapi/elasticsearch/database_logic.py,sha256=M6xIgtl3HB9p2V6wZPB6xm6cY02iYa2oG2OJRUbpA0c,58488
|
|
5
|
+
stac_fastapi/elasticsearch/version.py,sha256=rBLPQyvMDNA0PA0jXfByTouJPJn5p0wXiqmUWJMIfYc,45
|
|
6
|
+
stac_fastapi_elasticsearch-6.3.0.dist-info/METADATA,sha256=ijEkw05ul0-pg5rRfPMG0oKnXQd2iRNzvaIW4J4cSBo,36626
|
|
7
|
+
stac_fastapi_elasticsearch-6.3.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
8
|
+
stac_fastapi_elasticsearch-6.3.0.dist-info/entry_points.txt,sha256=aCKixki0LpUl64UPsPMtiNvfdyq-QsTCxVjJ54VF6Jk,82
|
|
9
|
+
stac_fastapi_elasticsearch-6.3.0.dist-info/top_level.txt,sha256=vqn-D9-HsRPTTxy0Vk_KkDmTiMES4owwBQ3ydSZYb2s,13
|
|
10
|
+
stac_fastapi_elasticsearch-6.3.0.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
stac_fastapi/elasticsearch/__init__.py,sha256=w_MZutYLreNV372sCuO46bPb0TngmPs4u8737ueS0wE,31
|
|
2
|
-
stac_fastapi/elasticsearch/app.py,sha256=Sdtyk4yeHJtbDim1rwLcKyDVLRQCSdAQV7JbD-fDMnk,5662
|
|
3
|
-
stac_fastapi/elasticsearch/config.py,sha256=itvPYr4TiOg9pWQrycgGaQxQ_Vc2KKP3aHdtH0OUZvw,5322
|
|
4
|
-
stac_fastapi/elasticsearch/database_logic.py,sha256=kG_GBGJxQlLDs-CRT9Jysesrrn-uKY2r6tS1rB_he30,58298
|
|
5
|
-
stac_fastapi/elasticsearch/version.py,sha256=ro2d3oERQL2KxSo7qmbU0z6qT77XShwY6vsqrLf2VFw,45
|
|
6
|
-
stac_fastapi_elasticsearch-6.2.0.dist-info/METADATA,sha256=uiqM95BihA3TWSwzLb9hRPbCec-SmnM8o-Vz8rgqqdI,35055
|
|
7
|
-
stac_fastapi_elasticsearch-6.2.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
8
|
-
stac_fastapi_elasticsearch-6.2.0.dist-info/entry_points.txt,sha256=aCKixki0LpUl64UPsPMtiNvfdyq-QsTCxVjJ54VF6Jk,82
|
|
9
|
-
stac_fastapi_elasticsearch-6.2.0.dist-info/top_level.txt,sha256=vqn-D9-HsRPTTxy0Vk_KkDmTiMES4owwBQ3ydSZYb2s,13
|
|
10
|
-
stac_fastapi_elasticsearch-6.2.0.dist-info/RECORD,,
|
{stac_fastapi_elasticsearch-6.2.0.dist-info → stac_fastapi_elasticsearch-6.3.0.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|