From 386fb6aa45591f66198150bb09cce9b2c6b09a9b Mon Sep 17 00:00:00 2001 From: Grzegorz Pustulka Date: Mon, 14 Jul 2025 16:30:34 +0200 Subject: [PATCH 1/3] Added collection-search#filter conformance class to CollectionSearchExtension to enable compatibility with stac-auth-proxy collection filtering --- CHANGELOG.md | 2 +- .../elasticsearch/stac_fastapi/elasticsearch/app.py | 6 ++++++ stac_fastapi/opensearch/stac_fastapi/opensearch/app.py | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 421e8315..7d776ee5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added - Added the ability to set timeout for Opensearch and Elasticsearch clients by setting the environmental variable `ES_TIMEOUT` [#408](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/408) - +- Added `collection-search#filter` conformance class to CollectionSearchExtension to enable compatibility with stac-auth-proxy collection filtering [#411](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/411) ## [v6.0.0] - 2025-06-22 ### Added diff --git a/stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/app.py b/stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/app.py index 7e145072..a555d495 100644 --- a/stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/app.py +++ b/stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/app.py @@ -31,6 +31,7 @@ ) from stac_fastapi.extensions.core import ( AggregationExtension, + CollectionSearchExtension, FilterExtension, FreeTextExtension, SortExtension, @@ -59,6 +60,10 @@ filter_extension.conformance_classes.append( FilterConformanceClasses.ADVANCED_COMPARISON_OPERATORS ) +collection_search_extension = CollectionSearchExtension() +collection_search_extension.conformance_classes.append( + "https://api.stacspec.org/v1.0.0-rc.1/collection-search#filter" +) aggregation_extension = AggregationExtension( client=EsAsyncBaseAggregationClient( @@ -75,6 +80,7 @@ TokenPaginationExtension(), filter_extension, FreeTextExtension(), + collection_search_extension, ] if TRANSACTIONS_EXTENSIONS: diff --git a/stac_fastapi/opensearch/stac_fastapi/opensearch/app.py b/stac_fastapi/opensearch/stac_fastapi/opensearch/app.py index c047014a..6b5a144d 100644 --- a/stac_fastapi/opensearch/stac_fastapi/opensearch/app.py +++ b/stac_fastapi/opensearch/stac_fastapi/opensearch/app.py @@ -25,6 +25,7 @@ from stac_fastapi.core.utilities import get_bool_env from stac_fastapi.extensions.core import ( AggregationExtension, + CollectionSearchExtension, FilterExtension, FreeTextExtension, SortExtension, @@ -59,6 +60,10 @@ filter_extension.conformance_classes.append( FilterConformanceClasses.ADVANCED_COMPARISON_OPERATORS ) +collection_search_extension = CollectionSearchExtension() +collection_search_extension.conformance_classes.append( + "https://api.stacspec.org/v1.0.0-rc.1/collection-search#filter" +) aggregation_extension = AggregationExtension( client=EsAsyncBaseAggregationClient( @@ -75,6 +80,7 @@ TokenPaginationExtension(), filter_extension, FreeTextExtension(), + collection_search_extension, ] From aa6743dad00c4e65917a9d9d7116ec119f78a57e Mon Sep 17 00:00:00 2001 From: Bennett Brixen Date: Sun, 20 Jul 2025 15:00:44 -0600 Subject: [PATCH 2/3] update ES env variable documentation (#410) fixes incorrect or missing documentation for ES_USE_SSL, ES_VERIFY_CERTS, and ES_API_KEY **Description:** - README.md documentation has incorrect default values for ES_USE_SSL and ES_VERIFY_CERTS - The default values that are used can be found at: `./stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/config.py` and `./stac_fastapi/opensearch/stac_fastapi/opensearch/config.py` - Adds documentation for ES_API_KEY **PR Checklist:** - [X] Code is formatted and linted (run `pre-commit run --all-files`) - [X] Tests pass (run `make test`) - [X] Documentation has been updated to reflect changes, if applicable - [X] Changes are added to the changelog --------- Co-authored-by: Bennett Patrick Brixen Co-authored-by: Jonathan Healy --- CHANGELOG.md | 2 ++ README.md | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68042a05..624b0043 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - Updated collection to index logic to support searching a large amount of indices [#412](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/412) +- Updated documentation to reflect use of ES environment variables [#410](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/410) +- Updated documentation to reflect `APP_PORT` in [stac-fastapi-core ApiSettings](https://github.com/stac-utils/stac-fastapi/blob/fa42985255fad0bab7dbe3aadbf1f74cb1635f3a/stac_fastapi/types/stac_fastapi/types/config.py#L30) [#410](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/410) ## [v6.0.0] - 2025-06-22 diff --git a/README.md b/README.md index 4d2cb807..9e5a4674 100644 --- a/README.md +++ b/README.md @@ -205,15 +205,16 @@ You can customize additional settings in your `.env` file: |------------------------------|--------------------------------------------------------------------------------------|--------------------------|---------------------------------------------------------------------------------------------| | `ES_HOST` | Hostname for external Elasticsearch/OpenSearch. | `localhost` | Optional | | `ES_PORT` | Port for Elasticsearch/OpenSearch. | `9200` (ES) / `9202` (OS)| Optional | -| `ES_USE_SSL` | Use SSL for connecting to Elasticsearch/OpenSearch. | `false` | Optional | -| `ES_VERIFY_CERTS` | Verify SSL certificates when connecting. | `false` | Optional | +| `ES_USE_SSL` | Use SSL for connecting to Elasticsearch/OpenSearch. | `true` | Optional | +| `ES_VERIFY_CERTS` | Verify SSL certificates when connecting. | `true` | Optional | +| `ES_API_KEY` | API Key for external Elasticsearch/OpenSearch. | N/A | Optional | | `ES_TIMEOUT` | Client timeout for Elasticsearch/OpenSearch. | DB client default | Optional | | `STAC_FASTAPI_TITLE` | Title of the API in the documentation. | `stac-fastapi-` | Optional | | `STAC_FASTAPI_DESCRIPTION` | Description of the API in the documentation. | N/A | Optional | | `STAC_FASTAPI_VERSION` | API version. | `2.1` | Optional | | `STAC_FASTAPI_LANDING_PAGE_ID` | Landing page ID | `stac-fastapi` | Optional | | `APP_HOST` | Server bind address. | `0.0.0.0` | Optional | -| `APP_PORT` | Server port. | `8080` | Optional | +| `APP_PORT` | Server port. | `8000` | Optional | | `ENVIRONMENT` | Runtime environment. | `local` | Optional | | `WEB_CONCURRENCY` | Number of worker processes. | `10` | Optional | | `RELOAD` | Enable auto-reload for development. | `true` | Optional | From 5ab140978de7f829dc5ff1179a0fb26503ae28ec Mon Sep 17 00:00:00 2001 From: Grzegorz Pustulka Date: Mon, 21 Jul 2025 11:55:34 +0200 Subject: [PATCH 3/3] explanatory comment --- stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/app.py | 4 ++++ stac_fastapi/opensearch/stac_fastapi/opensearch/app.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/app.py b/stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/app.py index a555d495..c348822f 100644 --- a/stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/app.py +++ b/stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/app.py @@ -60,6 +60,10 @@ filter_extension.conformance_classes.append( FilterConformanceClasses.ADVANCED_COMPARISON_OPERATORS ) + +# Adding collection search extension for compatibility with stac-auth-proxy +# (https://github.com/developmentseed/stac-auth-proxy) +# The extension is not fully implemented yet but is required for collection filtering support collection_search_extension = CollectionSearchExtension() collection_search_extension.conformance_classes.append( "https://api.stacspec.org/v1.0.0-rc.1/collection-search#filter" diff --git a/stac_fastapi/opensearch/stac_fastapi/opensearch/app.py b/stac_fastapi/opensearch/stac_fastapi/opensearch/app.py index 6b5a144d..b31281fa 100644 --- a/stac_fastapi/opensearch/stac_fastapi/opensearch/app.py +++ b/stac_fastapi/opensearch/stac_fastapi/opensearch/app.py @@ -60,6 +60,10 @@ filter_extension.conformance_classes.append( FilterConformanceClasses.ADVANCED_COMPARISON_OPERATORS ) + +# Adding collection search extension for compatibility with stac-auth-proxy +# (https://github.com/developmentseed/stac-auth-proxy) +# The extension is not fully implemented yet but is required for collection filtering support collection_search_extension = CollectionSearchExtension() collection_search_extension.conformance_classes.append( "https://api.stacspec.org/v1.0.0-rc.1/collection-search#filter"