stac-fastapi-opensearch 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.
@@ -25,6 +25,7 @@ from stac_fastapi.core.session import Session
25
25
  from stac_fastapi.core.utilities import get_bool_env
26
26
  from stac_fastapi.extensions.core import (
27
27
  AggregationExtension,
28
+ CollectionSearchExtension,
28
29
  FilterExtension,
29
30
  FreeTextExtension,
30
31
  SortExtension,
@@ -60,6 +61,14 @@ filter_extension.conformance_classes.append(
60
61
  FilterConformanceClasses.ADVANCED_COMPARISON_OPERATORS
61
62
  )
62
63
 
64
+ # Adding collection search extension for compatibility with stac-auth-proxy
65
+ # (https://github.com/developmentseed/stac-auth-proxy)
66
+ # The extension is not fully implemented yet but is required for collection filtering support
67
+ collection_search_extension = CollectionSearchExtension()
68
+ collection_search_extension.conformance_classes.append(
69
+ "https://api.stacspec.org/v1.0.0-rc.1/collection-search#filter"
70
+ )
71
+
63
72
  aggregation_extension = AggregationExtension(
64
73
  client=EsAsyncBaseAggregationClient(
65
74
  database=database_logic, session=session, settings=settings
@@ -75,6 +84,7 @@ search_extensions = [
75
84
  TokenPaginationExtension(),
76
85
  filter_extension,
77
86
  FreeTextExtension(),
87
+ collection_search_extension,
78
88
  ]
79
89
 
80
90
 
@@ -108,7 +118,7 @@ post_request_model = create_post_request_model(search_extensions)
108
118
  app_config = {
109
119
  "title": os.getenv("STAC_FASTAPI_TITLE", "stac-fastapi-opensearch"),
110
120
  "description": os.getenv("STAC_FASTAPI_DESCRIPTION", "stac-fastapi-opensearch"),
111
- "api_version": os.getenv("STAC_FASTAPI_VERSION", "6.0.0"),
121
+ "api_version": os.getenv("STAC_FASTAPI_VERSION", "6.1.0"),
112
122
  "settings": settings,
113
123
  "extensions": extensions,
114
124
  "client": CoreClient(
@@ -53,6 +53,10 @@ def _es_config() -> Dict[str, Any]:
53
53
 
54
54
  config["headers"] = headers
55
55
 
56
+ # Include timeout setting if set
57
+ if timeout := os.getenv("ES_TIMEOUT"):
58
+ config["timeout"] = timeout
59
+
56
60
  # Explicitly exclude SSL settings when not using SSL
57
61
  if not use_ssl:
58
62
  return config
@@ -42,6 +42,10 @@ from stac_fastapi.sfeos_helpers.database import (
42
42
  return_date,
43
43
  validate_refresh,
44
44
  )
45
+ from stac_fastapi.sfeos_helpers.database.query import (
46
+ ES_MAX_URL_LENGTH,
47
+ add_collections_to_body,
48
+ )
45
49
  from stac_fastapi.sfeos_helpers.database.utils import (
46
50
  merge_to_operations,
47
51
  operations_to_script,
@@ -532,6 +536,12 @@ class DatabaseLogic(BaseDatabaseLogic):
532
536
  """
533
537
  search_body: Dict[str, Any] = {}
534
538
  query = search.query.to_dict() if search.query else None
539
+
540
+ index_param = indices(collection_ids)
541
+ if len(index_param) > ES_MAX_URL_LENGTH - 300:
542
+ index_param = ITEM_INDICES
543
+ query = add_collections_to_body(collection_ids, query)
544
+
535
545
  if query:
536
546
  search_body["query"] = query
537
547
 
@@ -544,8 +554,6 @@ class DatabaseLogic(BaseDatabaseLogic):
544
554
 
545
555
  search_body["sort"] = sort if sort else DEFAULT_SORT
546
556
 
547
- index_param = indices(collection_ids)
548
-
549
557
  max_result_window = MAX_LIMIT
550
558
 
551
559
  size_limit = min(limit + 1, max_result_window)
@@ -1,2 +1,2 @@
1
1
  """library version."""
2
- __version__ = "6.0.0"
2
+ __version__ = "6.1.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stac-fastapi-opensearch
3
- Version: 6.0.0
3
+ Version: 6.1.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.0.0
19
- Requires-Dist: sfeos-helpers==6.0.0
18
+ Requires-Dist: stac-fastapi-core==6.1.0
19
+ Requires-Dist: sfeos-helpers==6.1.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
@@ -52,7 +52,7 @@ Requires-Dist: uvicorn[standard]~=0.23.0; extra == "server"
52
52
  [![GitHub forks](https://img.shields.io/github/forks/stac-utils/stac-fastapi-elasticsearch-opensearch.svg?color=blue)](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/network/members)
53
53
  [![PyPI version](https://img.shields.io/pypi/v/stac-fastapi-elasticsearch.svg?color=blue)](https://pypi.org/project/stac-fastapi-elasticsearch/)
54
54
  [![STAC](https://img.shields.io/badge/STAC-1.1.0-blue.svg)](https://github.com/radiantearth/stac-spec/tree/v1.1.0)
55
- [![stac-fastapi](https://img.shields.io/badge/stac--fastapi-5.2.0-blue.svg)](https://github.com/stac-utils/stac-fastapi)
55
+ [![stac-fastapi](https://img.shields.io/badge/stac--fastapi-6.0.0-blue.svg)](https://github.com/stac-utils/stac-fastapi)
56
56
 
57
57
  ## Sponsors & Supporters
58
58
 
@@ -242,28 +242,30 @@ You can customize additional settings in your `.env` file:
242
242
  |------------------------------|--------------------------------------------------------------------------------------|--------------------------|---------------------------------------------------------------------------------------------|
243
243
  | `ES_HOST` | Hostname for external Elasticsearch/OpenSearch. | `localhost` | Optional |
244
244
  | `ES_PORT` | Port for Elasticsearch/OpenSearch. | `9200` (ES) / `9202` (OS)| Optional |
245
- | `ES_USE_SSL` | Use SSL for connecting to Elasticsearch/OpenSearch. | `false` | Optional |
246
- | `ES_VERIFY_CERTS` | Verify SSL certificates when connecting. | `false` | Optional |
245
+ | `ES_USE_SSL` | Use SSL for connecting to Elasticsearch/OpenSearch. | `true` | Optional |
246
+ | `ES_VERIFY_CERTS` | Verify SSL certificates when connecting. | `true` | Optional |
247
+ | `ES_API_KEY` | API Key for external Elasticsearch/OpenSearch. | N/A | Optional |
248
+ | `ES_TIMEOUT` | Client timeout for Elasticsearch/OpenSearch. | DB client default | Optional |
247
249
  | `STAC_FASTAPI_TITLE` | Title of the API in the documentation. | `stac-fastapi-<backend>` | Optional |
248
250
  | `STAC_FASTAPI_DESCRIPTION` | Description of the API in the documentation. | N/A | Optional |
249
251
  | `STAC_FASTAPI_VERSION` | API version. | `2.1` | Optional |
250
- | `STAC_FASTAPI_LANDING_PAGE_ID` | Landing page ID | `stac-fastapi` | Optional |
252
+ | `STAC_FASTAPI_LANDING_PAGE_ID` | Landing page ID | `stac-fastapi` | Optional |
251
253
  | `APP_HOST` | Server bind address. | `0.0.0.0` | Optional |
252
- | `APP_PORT` | Server port. | `8080` | Optional |
254
+ | `APP_PORT` | Server port. | `8000` | Optional |
253
255
  | `ENVIRONMENT` | Runtime environment. | `local` | Optional |
254
256
  | `WEB_CONCURRENCY` | Number of worker processes. | `10` | Optional |
255
257
  | `RELOAD` | Enable auto-reload for development. | `true` | Optional |
256
258
  | `STAC_FASTAPI_RATE_LIMIT` | API rate limit per client. | `200/minute` | Optional |
257
- | `BACKEND` | Tests-related variable | `elasticsearch` or `opensearch` based on the backend | Optional |
258
- | `ELASTICSEARCH_VERSION` | Version of Elasticsearch to use. | `8.11.0` | Optional | |
259
- | `OPENSEARCH_VERSION` | OpenSearch version | `2.11.1` | Optional
260
- | `ENABLE_DIRECT_RESPONSE` | Enable direct response for maximum performance (disables all FastAPI dependencies, including authentication, custom status codes, and validation) | `false` | Optional
261
- | `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 |
262
- | `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 |
259
+ | `BACKEND` | Tests-related variable | `elasticsearch` or `opensearch` based on the backend | Optional |
260
+ | `ELASTICSEARCH_VERSION` | Version of Elasticsearch to use. | `8.11.0` | Optional |
261
+ | `OPENSEARCH_VERSION` | OpenSearch version | `2.11.1` | Optional |
262
+ | `ENABLE_DIRECT_RESPONSE` | Enable direct response for maximum performance (disables all FastAPI dependencies, including authentication, custom status codes, and validation) | `false` | Optional |
263
+ | `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
+ | `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 |
263
265
  | `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 |
264
266
 
265
267
  > [!NOTE]
266
- > The variables `ES_HOST`, `ES_PORT`, `ES_USE_SSL`, and `ES_VERIFY_CERTS` 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.
268
+ > 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.
267
269
 
268
270
  ## Interacting with the API
269
271
 
@@ -0,0 +1,10 @@
1
+ stac_fastapi/opensearch/__init__.py,sha256=iJWMUgn7mUvmuPQSO_FlyhJ5eDdbbfmGv1qnFOX5-qk,28
2
+ stac_fastapi/opensearch/app.py,sha256=EBaN0W8-jP9Q568J6UlC_xM7uWx7PkfE4RulnxYJCYs,5642
3
+ stac_fastapi/opensearch/config.py,sha256=tR-CP3l96pte0gdbQqDHAQVZrWbL57krMrFalLKCTBc,5178
4
+ stac_fastapi/opensearch/database_logic.py,sha256=9c2UKJcFaaZ9fcXUkCYnDy06G16BHGu96kb13Clg0ow,54664
5
+ stac_fastapi/opensearch/version.py,sha256=7IrY7mbr0cGVqZsk6wmCeITxZjDgz_mPHUswrziX5ME,45
6
+ stac_fastapi_opensearch-6.1.0.dist-info/METADATA,sha256=CgFBwwx65wUV-jcw3sbSFhUKcre3GgfWUBlwEhOQRuM,32250
7
+ stac_fastapi_opensearch-6.1.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
8
+ stac_fastapi_opensearch-6.1.0.dist-info/entry_points.txt,sha256=zjZ0Xsr9BUNJqMkdPpl6zEIUykv1uFdJtNELFRChp0w,76
9
+ stac_fastapi_opensearch-6.1.0.dist-info/top_level.txt,sha256=vqn-D9-HsRPTTxy0Vk_KkDmTiMES4owwBQ3ydSZYb2s,13
10
+ stac_fastapi_opensearch-6.1.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=IX_SVF8S4HxiFYG3LL4Z_Ub37lKtbuoyAiWEZCuopSw,5168
3
- stac_fastapi/opensearch/config.py,sha256=HfaUvcQM2kGNjypdUYFUcrMmBUPu3pG31mvNRESeR_A,5061
4
- stac_fastapi/opensearch/database_logic.py,sha256=YSAiTv1t4Pm_RRAkc74J-_-FvPQCXmkgJ17VYQ4JpB8,54392
5
- stac_fastapi/opensearch/version.py,sha256=Fo5UFEQVxJZ3nywa3IY-enu5UQBE0X45nrQaRBe8c9o,45
6
- stac_fastapi_opensearch-6.0.0.dist-info/METADATA,sha256=zArSUfZvRiCTWQNTmcu6fZqRho0yYvlsvUzOENeuZ4Y,31895
7
- stac_fastapi_opensearch-6.0.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
8
- stac_fastapi_opensearch-6.0.0.dist-info/entry_points.txt,sha256=zjZ0Xsr9BUNJqMkdPpl6zEIUykv1uFdJtNELFRChp0w,76
9
- stac_fastapi_opensearch-6.0.0.dist-info/top_level.txt,sha256=vqn-D9-HsRPTTxy0Vk_KkDmTiMES4owwBQ3ydSZYb2s,13
10
- stac_fastapi_opensearch-6.0.0.dist-info/RECORD,,