sfeos-helpers 6.2.1__tar.gz → 6.4.0__tar.gz

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.
Files changed (39) hide show
  1. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/PKG-INFO +80 -33
  2. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/README.md +78 -22
  3. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/setup.py +1 -1
  4. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/sfeos_helpers.egg-info/PKG-INFO +81 -34
  5. sfeos_helpers-6.4.0/sfeos_helpers.egg-info/requires.txt +1 -0
  6. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/sfeos_helpers.egg-info/top_level.txt +0 -1
  7. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/database/utils.py +3 -3
  8. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/filter/client.py +6 -3
  9. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/mappings.py +6 -2
  10. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/version.py +1 -1
  11. sfeos_helpers-6.2.1/sfeos_helpers.egg-info/requires.txt +0 -1
  12. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/setup.cfg +0 -0
  13. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/sfeos_helpers.egg-info/SOURCES.txt +0 -0
  14. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/sfeos_helpers.egg-info/dependency_links.txt +0 -0
  15. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/sfeos_helpers.egg-info/not-zip-safe +0 -0
  16. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/aggregation/__init__.py +0 -0
  17. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/aggregation/client.py +0 -0
  18. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/aggregation/format.py +0 -0
  19. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/database/__init__.py +0 -0
  20. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/database/datetime.py +0 -0
  21. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/database/document.py +0 -0
  22. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/database/index.py +0 -0
  23. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/database/mapping.py +0 -0
  24. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/database/query.py +0 -0
  25. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/filter/__init__.py +0 -0
  26. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/filter/cql2.py +0 -0
  27. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/filter/transform.py +0 -0
  28. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/models/patch.py +0 -0
  29. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/search_engine/__init__.py +0 -0
  30. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/search_engine/base.py +0 -0
  31. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/search_engine/factory.py +0 -0
  32. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/search_engine/index_operations.py +0 -0
  33. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/search_engine/inserters.py +0 -0
  34. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/search_engine/managers.py +0 -0
  35. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/search_engine/selection/__init__.py +0 -0
  36. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/search_engine/selection/base.py +0 -0
  37. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/search_engine/selection/cache_manager.py +0 -0
  38. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/search_engine/selection/factory.py +0 -0
  39. {sfeos_helpers-6.2.1 → sfeos_helpers-6.4.0}/stac_fastapi/sfeos_helpers/search_engine/selection/selectors.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.1
2
2
  Name: sfeos_helpers
3
- Version: 6.2.1
3
+ Version: 6.4.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,15 +15,6 @@ 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.2.1
19
- Dynamic: classifier
20
- Dynamic: description
21
- Dynamic: description-content-type
22
- Dynamic: home-page
23
- Dynamic: license
24
- Dynamic: requires-dist
25
- Dynamic: requires-python
26
- Dynamic: summary
27
18
 
28
19
  # stac-fastapi-elasticsearch-opensearch
29
20
 
@@ -63,11 +54,10 @@ SFEOS (stac-fastapi-elasticsearch-opensearch) is a high-performance, scalable AP
63
54
  - **Scale to millions of geospatial assets** with fast search performance through optimized spatial indexing and query capabilities
64
55
  - **Support OGC-compliant filtering** including spatial operations (intersects, contains, etc.) and temporal queries
65
56
  - **Perform geospatial aggregations** to analyze data distribution across space and time
57
+ - **Enhanced collection search capabilities** with support for sorting and field selection
66
58
 
67
59
  This implementation builds on the STAC-FastAPI framework, providing a production-ready solution specifically optimized for Elasticsearch and OpenSearch databases. It's ideal for organizations managing large geospatial data catalogs who need efficient discovery and access capabilities through standardized APIs.
68
60
 
69
-
70
-
71
61
  ## Common Deployment Patterns
72
62
 
73
63
  stac-fastapi-elasticsearch-opensearch can be deployed in several ways depending on your needs:
@@ -93,26 +83,44 @@ This project is built on the following technologies: STAC, stac-fastapi, FastAPI
93
83
 
94
84
  ## Table of Contents
95
85
 
96
- - [Documentation & Resources](#documentation--resources)
97
- - [Package Structure](#package-structure)
98
- - [Examples](#examples)
99
- - [Performance](#performance)
100
- - [Quick Start](#quick-start)
101
- - [Installation](#installation)
102
- - [Running Locally](#running-locally)
103
- - [Configuration reference](#configuration-reference)
104
- - [Interacting with the API](#interacting-with-the-api)
105
- - [Configure the API](#configure-the-api)
106
- - [Collection pagination](#collection-pagination)
107
- - [Ingesting Sample Data CLI Tool](#ingesting-sample-data-cli-tool)
108
- - [Elasticsearch Mappings](#elasticsearch-mappings)
109
- - [Managing Elasticsearch Indices](#managing-elasticsearch-indices)
110
- - [Snapshots](#snapshots)
111
- - [Reindexing](#reindexing)
112
- - [Auth](#auth)
113
- - [Aggregation](#aggregation)
114
- - [Rate Limiting](#rate-limiting)
115
- - [Datetime-Based Index Management](#datetime-based-index-management)
86
+ - [stac-fastapi-elasticsearch-opensearch](#stac-fastapi-elasticsearch-opensearch)
87
+ - [Sponsors \& Supporters](#sponsors--supporters)
88
+ - [Project Introduction - What is SFEOS?](#project-introduction---what-is-sfeos)
89
+ - [Common Deployment Patterns](#common-deployment-patterns)
90
+ - [Technologies](#technologies)
91
+ - [Table of Contents](#table-of-contents)
92
+ - [Collection Search Extensions](#collection-search-extensions)
93
+ - [Documentation \& Resources](#documentation--resources)
94
+ - [Package Structure](#package-structure)
95
+ - [Examples](#examples)
96
+ - [Performance](#performance)
97
+ - [Direct Response Mode](#direct-response-mode)
98
+ - [Quick Start](#quick-start)
99
+ - [Installation](#installation)
100
+ - [Running Locally](#running-locally)
101
+ - [Using Pre-built Docker Images](#using-pre-built-docker-images)
102
+ - [Using Docker Compose](#using-docker-compose)
103
+ - [Configuration Reference](#configuration-reference)
104
+ - [Datetime-Based Index Management](#datetime-based-index-management)
105
+ - [Overview](#overview)
106
+ - [When to Use](#when-to-use)
107
+ - [Configuration](#configuration)
108
+ - [Enabling Datetime-Based Indexing](#enabling-datetime-based-indexing)
109
+ - [Related Configuration Variables](#related-configuration-variables)
110
+ - [How Datetime-Based Indexing Works](#how-datetime-based-indexing-works)
111
+ - [Index and Alias Naming Convention](#index-and-alias-naming-convention)
112
+ - [Index Size Management](#index-size-management)
113
+ - [Interacting with the API](#interacting-with-the-api)
114
+ - [Configure the API](#configure-the-api)
115
+ - [Collection Pagination](#collection-pagination)
116
+ - [Ingesting Sample Data CLI Tool](#ingesting-sample-data-cli-tool)
117
+ - [Elasticsearch Mappings](#elasticsearch-mappings)
118
+ - [Managing Elasticsearch Indices](#managing-elasticsearch-indices)
119
+ - [Snapshots](#snapshots)
120
+ - [Reindexing](#reindexing)
121
+ - [Auth](#auth)
122
+ - [Aggregation](#aggregation)
123
+ - [Rate Limiting](#rate-limiting)
116
124
 
117
125
  ## Documentation & Resources
118
126
 
@@ -123,6 +131,37 @@ This project is built on the following technologies: STAC, stac-fastapi, FastAPI
123
131
  - [Gitter Chat](https://app.gitter.im/#/room/#stac-fastapi-elasticsearch_community:gitter.im) - For real-time discussions
124
132
  - [GitHub Discussions](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/discussions) - For longer-form questions and answers
125
133
 
134
+ ## Collection Search Extensions
135
+
136
+ SFEOS implements extended capabilities for the `/collections` endpoint, allowing for more powerful collection discovery:
137
+
138
+ - **Sorting**: Sort collections by sortable fields using the `sortby` parameter
139
+ - Example: `/collections?sortby=+id` (ascending sort by ID)
140
+ - Example: `/collections?sortby=-id` (descending sort by ID)
141
+ - Example: `/collections?sortby=-temporal` (descending sort by temporal extent)
142
+
143
+ - **Field Selection**: Request only specific fields to be returned using the `fields` parameter
144
+ - Example: `/collections?fields=id,title,description`
145
+ - This helps reduce payload size when only certain fields are needed
146
+
147
+ - **Free Text Search**: Search across collection text fields using the `q` parameter
148
+ - Example: `/collections?q=landsat`
149
+ - Searches across multiple text fields including title, description, and keywords
150
+ - Supports partial word matching and relevance-based sorting
151
+
152
+ These extensions make it easier to build user interfaces that display and navigate through collections efficiently.
153
+
154
+ > **Configuration**: Collection search extensions can be disabled by setting the `ENABLE_COLLECTIONS_SEARCH` environment variable to `false`. By default, these extensions are enabled.
155
+
156
+ > **Note**: Sorting is only available on fields that are indexed for sorting in Elasticsearch/OpenSearch. With the default mappings, you can sort on:
157
+ > - `id` (keyword field)
158
+ > - `extent.temporal.interval` (date field)
159
+ > - `temporal` (alias to extent.temporal.interval)
160
+ >
161
+ > Text fields like `title` and `description` are not sortable by default as they use text analysis for better search capabilities. Attempting to sort on these fields will result in a user-friendly error message explaining which fields are sortable and how to make additional fields sortable by updating the mappings.
162
+ >
163
+ > **Important**: Adding keyword fields to make text fields sortable can significantly increase the index size, especially for large text fields. Consider the storage implications when deciding which fields to make sortable.
164
+
126
165
  ## Package Structure
127
166
 
128
167
  This project is organized into several packages, each with a specific purpose:
@@ -253,8 +292,12 @@ You can customize additional settings in your `.env` file:
253
292
  | `ENABLE_DIRECT_RESPONSE` | Enable direct response for maximum performance (disables all FastAPI dependencies, including authentication, custom status codes, and validation) | `false` | Optional |
254
293
  | `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 |
255
294
  | `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 |
295
+ | `ENABLE_COLLECTIONS_SEARCH` | Enable collection search extensions (sort, fields). | `true` | Optional |
256
296
  | `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 |
257
297
  | `STAC_ITEM_LIMIT` | Sets the environment variable for result limiting to SFEOS for the number of returned items and STAC collections. | `10` | Optional |
298
+ | `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 |
299
+ | `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 |
300
+ | `USE_DATETIME` | Configures the datetime search behavior in SFEOS. When enabled, searches both datetime field and falls back to start_datetime/end_datetime range for items with null datetime. When disabled, searches only by start_datetime/end_datetime range. | True | Optional |
258
301
 
259
302
  > [!NOTE]
260
303
  > 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.
@@ -396,6 +439,10 @@ The system uses a precise naming convention:
396
439
  - **Root Path Configuration**: The application root path is the base URL by default.
397
440
  - For AWS Lambda with Gateway API: Set `STAC_FASTAPI_ROOT_PATH` to match the Gateway API stage name (e.g., `/v1`)
398
441
 
442
+ - **Feature Configuration**: Control which features are enabled:
443
+ - `ENABLE_COLLECTIONS_SEARCH`: Set to `true` (default) to enable collection search extensions (sort, fields). Set to `false` to disable.
444
+ - `ENABLE_TRANSACTIONS_EXTENSIONS`: Set to `true` (default) to enable transaction extensions. Set to `false` to disable.
445
+
399
446
 
400
447
  ## Collection Pagination
401
448
 
@@ -36,11 +36,10 @@ SFEOS (stac-fastapi-elasticsearch-opensearch) is a high-performance, scalable AP
36
36
  - **Scale to millions of geospatial assets** with fast search performance through optimized spatial indexing and query capabilities
37
37
  - **Support OGC-compliant filtering** including spatial operations (intersects, contains, etc.) and temporal queries
38
38
  - **Perform geospatial aggregations** to analyze data distribution across space and time
39
+ - **Enhanced collection search capabilities** with support for sorting and field selection
39
40
 
40
41
  This implementation builds on the STAC-FastAPI framework, providing a production-ready solution specifically optimized for Elasticsearch and OpenSearch databases. It's ideal for organizations managing large geospatial data catalogs who need efficient discovery and access capabilities through standardized APIs.
41
42
 
42
-
43
-
44
43
  ## Common Deployment Patterns
45
44
 
46
45
  stac-fastapi-elasticsearch-opensearch can be deployed in several ways depending on your needs:
@@ -66,26 +65,44 @@ This project is built on the following technologies: STAC, stac-fastapi, FastAPI
66
65
 
67
66
  ## Table of Contents
68
67
 
69
- - [Documentation & Resources](#documentation--resources)
70
- - [Package Structure](#package-structure)
71
- - [Examples](#examples)
72
- - [Performance](#performance)
73
- - [Quick Start](#quick-start)
74
- - [Installation](#installation)
75
- - [Running Locally](#running-locally)
76
- - [Configuration reference](#configuration-reference)
77
- - [Interacting with the API](#interacting-with-the-api)
78
- - [Configure the API](#configure-the-api)
79
- - [Collection pagination](#collection-pagination)
80
- - [Ingesting Sample Data CLI Tool](#ingesting-sample-data-cli-tool)
81
- - [Elasticsearch Mappings](#elasticsearch-mappings)
82
- - [Managing Elasticsearch Indices](#managing-elasticsearch-indices)
83
- - [Snapshots](#snapshots)
84
- - [Reindexing](#reindexing)
85
- - [Auth](#auth)
86
- - [Aggregation](#aggregation)
87
- - [Rate Limiting](#rate-limiting)
88
- - [Datetime-Based Index Management](#datetime-based-index-management)
68
+ - [stac-fastapi-elasticsearch-opensearch](#stac-fastapi-elasticsearch-opensearch)
69
+ - [Sponsors \& Supporters](#sponsors--supporters)
70
+ - [Project Introduction - What is SFEOS?](#project-introduction---what-is-sfeos)
71
+ - [Common Deployment Patterns](#common-deployment-patterns)
72
+ - [Technologies](#technologies)
73
+ - [Table of Contents](#table-of-contents)
74
+ - [Collection Search Extensions](#collection-search-extensions)
75
+ - [Documentation \& Resources](#documentation--resources)
76
+ - [Package Structure](#package-structure)
77
+ - [Examples](#examples)
78
+ - [Performance](#performance)
79
+ - [Direct Response Mode](#direct-response-mode)
80
+ - [Quick Start](#quick-start)
81
+ - [Installation](#installation)
82
+ - [Running Locally](#running-locally)
83
+ - [Using Pre-built Docker Images](#using-pre-built-docker-images)
84
+ - [Using Docker Compose](#using-docker-compose)
85
+ - [Configuration Reference](#configuration-reference)
86
+ - [Datetime-Based Index Management](#datetime-based-index-management)
87
+ - [Overview](#overview)
88
+ - [When to Use](#when-to-use)
89
+ - [Configuration](#configuration)
90
+ - [Enabling Datetime-Based Indexing](#enabling-datetime-based-indexing)
91
+ - [Related Configuration Variables](#related-configuration-variables)
92
+ - [How Datetime-Based Indexing Works](#how-datetime-based-indexing-works)
93
+ - [Index and Alias Naming Convention](#index-and-alias-naming-convention)
94
+ - [Index Size Management](#index-size-management)
95
+ - [Interacting with the API](#interacting-with-the-api)
96
+ - [Configure the API](#configure-the-api)
97
+ - [Collection Pagination](#collection-pagination)
98
+ - [Ingesting Sample Data CLI Tool](#ingesting-sample-data-cli-tool)
99
+ - [Elasticsearch Mappings](#elasticsearch-mappings)
100
+ - [Managing Elasticsearch Indices](#managing-elasticsearch-indices)
101
+ - [Snapshots](#snapshots)
102
+ - [Reindexing](#reindexing)
103
+ - [Auth](#auth)
104
+ - [Aggregation](#aggregation)
105
+ - [Rate Limiting](#rate-limiting)
89
106
 
90
107
  ## Documentation & Resources
91
108
 
@@ -96,6 +113,37 @@ This project is built on the following technologies: STAC, stac-fastapi, FastAPI
96
113
  - [Gitter Chat](https://app.gitter.im/#/room/#stac-fastapi-elasticsearch_community:gitter.im) - For real-time discussions
97
114
  - [GitHub Discussions](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/discussions) - For longer-form questions and answers
98
115
 
116
+ ## Collection Search Extensions
117
+
118
+ SFEOS implements extended capabilities for the `/collections` endpoint, allowing for more powerful collection discovery:
119
+
120
+ - **Sorting**: Sort collections by sortable fields using the `sortby` parameter
121
+ - Example: `/collections?sortby=+id` (ascending sort by ID)
122
+ - Example: `/collections?sortby=-id` (descending sort by ID)
123
+ - Example: `/collections?sortby=-temporal` (descending sort by temporal extent)
124
+
125
+ - **Field Selection**: Request only specific fields to be returned using the `fields` parameter
126
+ - Example: `/collections?fields=id,title,description`
127
+ - This helps reduce payload size when only certain fields are needed
128
+
129
+ - **Free Text Search**: Search across collection text fields using the `q` parameter
130
+ - Example: `/collections?q=landsat`
131
+ - Searches across multiple text fields including title, description, and keywords
132
+ - Supports partial word matching and relevance-based sorting
133
+
134
+ These extensions make it easier to build user interfaces that display and navigate through collections efficiently.
135
+
136
+ > **Configuration**: Collection search extensions can be disabled by setting the `ENABLE_COLLECTIONS_SEARCH` environment variable to `false`. By default, these extensions are enabled.
137
+
138
+ > **Note**: Sorting is only available on fields that are indexed for sorting in Elasticsearch/OpenSearch. With the default mappings, you can sort on:
139
+ > - `id` (keyword field)
140
+ > - `extent.temporal.interval` (date field)
141
+ > - `temporal` (alias to extent.temporal.interval)
142
+ >
143
+ > Text fields like `title` and `description` are not sortable by default as they use text analysis for better search capabilities. Attempting to sort on these fields will result in a user-friendly error message explaining which fields are sortable and how to make additional fields sortable by updating the mappings.
144
+ >
145
+ > **Important**: Adding keyword fields to make text fields sortable can significantly increase the index size, especially for large text fields. Consider the storage implications when deciding which fields to make sortable.
146
+
99
147
  ## Package Structure
100
148
 
101
149
  This project is organized into several packages, each with a specific purpose:
@@ -226,8 +274,12 @@ You can customize additional settings in your `.env` file:
226
274
  | `ENABLE_DIRECT_RESPONSE` | Enable direct response for maximum performance (disables all FastAPI dependencies, including authentication, custom status codes, and validation) | `false` | Optional |
227
275
  | `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 |
228
276
  | `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 |
277
+ | `ENABLE_COLLECTIONS_SEARCH` | Enable collection search extensions (sort, fields). | `true` | Optional |
229
278
  | `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 |
230
279
  | `STAC_ITEM_LIMIT` | Sets the environment variable for result limiting to SFEOS for the number of returned items and STAC collections. | `10` | Optional |
280
+ | `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 |
281
+ | `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 |
282
+ | `USE_DATETIME` | Configures the datetime search behavior in SFEOS. When enabled, searches both datetime field and falls back to start_datetime/end_datetime range for items with null datetime. When disabled, searches only by start_datetime/end_datetime range. | True | Optional |
231
283
 
232
284
  > [!NOTE]
233
285
  > 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.
@@ -369,6 +421,10 @@ The system uses a precise naming convention:
369
421
  - **Root Path Configuration**: The application root path is the base URL by default.
370
422
  - For AWS Lambda with Gateway API: Set `STAC_FASTAPI_ROOT_PATH` to match the Gateway API stage name (e.g., `/v1`)
371
423
 
424
+ - **Feature Configuration**: Control which features are enabled:
425
+ - `ENABLE_COLLECTIONS_SEARCH`: Set to `true` (default) to enable collection search extensions (sort, fields). Set to `false` to disable.
426
+ - `ENABLE_TRANSACTIONS_EXTENSIONS`: Set to `true` (default) to enable transaction extensions. Set to `false` to disable.
427
+
372
428
 
373
429
  ## Collection Pagination
374
430
 
@@ -6,7 +6,7 @@ with open("README.md") as f:
6
6
  desc = f.read()
7
7
 
8
8
  install_requires = [
9
- "stac-fastapi.core==6.2.1",
9
+ "stac-fastapi.core==6.4.0",
10
10
  ]
11
11
 
12
12
  setup(
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
2
- Name: sfeos_helpers
3
- Version: 6.2.1
1
+ Metadata-Version: 2.1
2
+ Name: sfeos-helpers
3
+ Version: 6.4.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,15 +15,6 @@ 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.2.1
19
- Dynamic: classifier
20
- Dynamic: description
21
- Dynamic: description-content-type
22
- Dynamic: home-page
23
- Dynamic: license
24
- Dynamic: requires-dist
25
- Dynamic: requires-python
26
- Dynamic: summary
27
18
 
28
19
  # stac-fastapi-elasticsearch-opensearch
29
20
 
@@ -63,11 +54,10 @@ SFEOS (stac-fastapi-elasticsearch-opensearch) is a high-performance, scalable AP
63
54
  - **Scale to millions of geospatial assets** with fast search performance through optimized spatial indexing and query capabilities
64
55
  - **Support OGC-compliant filtering** including spatial operations (intersects, contains, etc.) and temporal queries
65
56
  - **Perform geospatial aggregations** to analyze data distribution across space and time
57
+ - **Enhanced collection search capabilities** with support for sorting and field selection
66
58
 
67
59
  This implementation builds on the STAC-FastAPI framework, providing a production-ready solution specifically optimized for Elasticsearch and OpenSearch databases. It's ideal for organizations managing large geospatial data catalogs who need efficient discovery and access capabilities through standardized APIs.
68
60
 
69
-
70
-
71
61
  ## Common Deployment Patterns
72
62
 
73
63
  stac-fastapi-elasticsearch-opensearch can be deployed in several ways depending on your needs:
@@ -93,26 +83,44 @@ This project is built on the following technologies: STAC, stac-fastapi, FastAPI
93
83
 
94
84
  ## Table of Contents
95
85
 
96
- - [Documentation & Resources](#documentation--resources)
97
- - [Package Structure](#package-structure)
98
- - [Examples](#examples)
99
- - [Performance](#performance)
100
- - [Quick Start](#quick-start)
101
- - [Installation](#installation)
102
- - [Running Locally](#running-locally)
103
- - [Configuration reference](#configuration-reference)
104
- - [Interacting with the API](#interacting-with-the-api)
105
- - [Configure the API](#configure-the-api)
106
- - [Collection pagination](#collection-pagination)
107
- - [Ingesting Sample Data CLI Tool](#ingesting-sample-data-cli-tool)
108
- - [Elasticsearch Mappings](#elasticsearch-mappings)
109
- - [Managing Elasticsearch Indices](#managing-elasticsearch-indices)
110
- - [Snapshots](#snapshots)
111
- - [Reindexing](#reindexing)
112
- - [Auth](#auth)
113
- - [Aggregation](#aggregation)
114
- - [Rate Limiting](#rate-limiting)
115
- - [Datetime-Based Index Management](#datetime-based-index-management)
86
+ - [stac-fastapi-elasticsearch-opensearch](#stac-fastapi-elasticsearch-opensearch)
87
+ - [Sponsors \& Supporters](#sponsors--supporters)
88
+ - [Project Introduction - What is SFEOS?](#project-introduction---what-is-sfeos)
89
+ - [Common Deployment Patterns](#common-deployment-patterns)
90
+ - [Technologies](#technologies)
91
+ - [Table of Contents](#table-of-contents)
92
+ - [Collection Search Extensions](#collection-search-extensions)
93
+ - [Documentation \& Resources](#documentation--resources)
94
+ - [Package Structure](#package-structure)
95
+ - [Examples](#examples)
96
+ - [Performance](#performance)
97
+ - [Direct Response Mode](#direct-response-mode)
98
+ - [Quick Start](#quick-start)
99
+ - [Installation](#installation)
100
+ - [Running Locally](#running-locally)
101
+ - [Using Pre-built Docker Images](#using-pre-built-docker-images)
102
+ - [Using Docker Compose](#using-docker-compose)
103
+ - [Configuration Reference](#configuration-reference)
104
+ - [Datetime-Based Index Management](#datetime-based-index-management)
105
+ - [Overview](#overview)
106
+ - [When to Use](#when-to-use)
107
+ - [Configuration](#configuration)
108
+ - [Enabling Datetime-Based Indexing](#enabling-datetime-based-indexing)
109
+ - [Related Configuration Variables](#related-configuration-variables)
110
+ - [How Datetime-Based Indexing Works](#how-datetime-based-indexing-works)
111
+ - [Index and Alias Naming Convention](#index-and-alias-naming-convention)
112
+ - [Index Size Management](#index-size-management)
113
+ - [Interacting with the API](#interacting-with-the-api)
114
+ - [Configure the API](#configure-the-api)
115
+ - [Collection Pagination](#collection-pagination)
116
+ - [Ingesting Sample Data CLI Tool](#ingesting-sample-data-cli-tool)
117
+ - [Elasticsearch Mappings](#elasticsearch-mappings)
118
+ - [Managing Elasticsearch Indices](#managing-elasticsearch-indices)
119
+ - [Snapshots](#snapshots)
120
+ - [Reindexing](#reindexing)
121
+ - [Auth](#auth)
122
+ - [Aggregation](#aggregation)
123
+ - [Rate Limiting](#rate-limiting)
116
124
 
117
125
  ## Documentation & Resources
118
126
 
@@ -123,6 +131,37 @@ This project is built on the following technologies: STAC, stac-fastapi, FastAPI
123
131
  - [Gitter Chat](https://app.gitter.im/#/room/#stac-fastapi-elasticsearch_community:gitter.im) - For real-time discussions
124
132
  - [GitHub Discussions](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/discussions) - For longer-form questions and answers
125
133
 
134
+ ## Collection Search Extensions
135
+
136
+ SFEOS implements extended capabilities for the `/collections` endpoint, allowing for more powerful collection discovery:
137
+
138
+ - **Sorting**: Sort collections by sortable fields using the `sortby` parameter
139
+ - Example: `/collections?sortby=+id` (ascending sort by ID)
140
+ - Example: `/collections?sortby=-id` (descending sort by ID)
141
+ - Example: `/collections?sortby=-temporal` (descending sort by temporal extent)
142
+
143
+ - **Field Selection**: Request only specific fields to be returned using the `fields` parameter
144
+ - Example: `/collections?fields=id,title,description`
145
+ - This helps reduce payload size when only certain fields are needed
146
+
147
+ - **Free Text Search**: Search across collection text fields using the `q` parameter
148
+ - Example: `/collections?q=landsat`
149
+ - Searches across multiple text fields including title, description, and keywords
150
+ - Supports partial word matching and relevance-based sorting
151
+
152
+ These extensions make it easier to build user interfaces that display and navigate through collections efficiently.
153
+
154
+ > **Configuration**: Collection search extensions can be disabled by setting the `ENABLE_COLLECTIONS_SEARCH` environment variable to `false`. By default, these extensions are enabled.
155
+
156
+ > **Note**: Sorting is only available on fields that are indexed for sorting in Elasticsearch/OpenSearch. With the default mappings, you can sort on:
157
+ > - `id` (keyword field)
158
+ > - `extent.temporal.interval` (date field)
159
+ > - `temporal` (alias to extent.temporal.interval)
160
+ >
161
+ > Text fields like `title` and `description` are not sortable by default as they use text analysis for better search capabilities. Attempting to sort on these fields will result in a user-friendly error message explaining which fields are sortable and how to make additional fields sortable by updating the mappings.
162
+ >
163
+ > **Important**: Adding keyword fields to make text fields sortable can significantly increase the index size, especially for large text fields. Consider the storage implications when deciding which fields to make sortable.
164
+
126
165
  ## Package Structure
127
166
 
128
167
  This project is organized into several packages, each with a specific purpose:
@@ -253,8 +292,12 @@ You can customize additional settings in your `.env` file:
253
292
  | `ENABLE_DIRECT_RESPONSE` | Enable direct response for maximum performance (disables all FastAPI dependencies, including authentication, custom status codes, and validation) | `false` | Optional |
254
293
  | `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 |
255
294
  | `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 |
295
+ | `ENABLE_COLLECTIONS_SEARCH` | Enable collection search extensions (sort, fields). | `true` | Optional |
256
296
  | `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 |
257
297
  | `STAC_ITEM_LIMIT` | Sets the environment variable for result limiting to SFEOS for the number of returned items and STAC collections. | `10` | Optional |
298
+ | `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 |
299
+ | `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 |
300
+ | `USE_DATETIME` | Configures the datetime search behavior in SFEOS. When enabled, searches both datetime field and falls back to start_datetime/end_datetime range for items with null datetime. When disabled, searches only by start_datetime/end_datetime range. | True | Optional |
258
301
 
259
302
  > [!NOTE]
260
303
  > 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.
@@ -396,6 +439,10 @@ The system uses a precise naming convention:
396
439
  - **Root Path Configuration**: The application root path is the base URL by default.
397
440
  - For AWS Lambda with Gateway API: Set `STAC_FASTAPI_ROOT_PATH` to match the Gateway API stage name (e.g., `/v1`)
398
441
 
442
+ - **Feature Configuration**: Control which features are enabled:
443
+ - `ENABLE_COLLECTIONS_SEARCH`: Set to `true` (default) to enable collection search extensions (sort, fields). Set to `false` to disable.
444
+ - `ENABLE_TRANSACTIONS_EXTENSIONS`: Set to `true` (default) to enable transaction extensions. Set to `false` to disable.
445
+
399
446
 
400
447
  ## Collection Pagination
401
448
 
@@ -0,0 +1 @@
1
+ stac-fastapi.core==6.4.0
@@ -114,7 +114,7 @@ def check_commands(
114
114
  commands.add(
115
115
  f"if (!ctx._source{part_nest}.containsKey('{path_part}'))"
116
116
  f"{{ctx._source{part_nest}['{path_part}'] = {value};}}"
117
- f"{'' if index == len(path.parts) - 1 else' else '}"
117
+ f"{'' if index == len(path.parts) - 1 else' else '}" # noqa: E275
118
118
  )
119
119
 
120
120
  else:
@@ -133,12 +133,12 @@ def check_commands(
133
133
  f" && ctx._source{path.es_nest}.size() < {abs(path.key)})"
134
134
  f" || (!(ctx._source{path.es_nest} instanceof ArrayList)"
135
135
  f" && !ctx._source{path.es_nest}.containsKey('{path.key}')))"
136
- f"{{Debug.explain('{path.key} does not exist in {path.nest}');}}"
136
+ f"{{Debug.explain('{path.key} does not exist in {path.nest}');}}" # noqa: E713
137
137
  )
138
138
  else:
139
139
  commands.add(
140
140
  f"if (!ctx._source{path.es_nest}.containsKey('{path.key}'))"
141
- f"{{Debug.explain('{path.key} does not exist in {path.nest}');}}"
141
+ f"{{Debug.explain('{path.key} does not exist in {path.nest}');}}" # noqa: E713
142
142
  )
143
143
 
144
144
 
@@ -4,6 +4,7 @@ from collections import deque
4
4
  from typing import Any, Dict, Optional, Tuple
5
5
 
6
6
  import attr
7
+ from fastapi import Request
7
8
 
8
9
  from stac_fastapi.core.base_database_logic import BaseDatabaseLogic
9
10
  from stac_fastapi.core.extensions.filter import ALL_QUERYABLES, DEFAULT_QUERYABLES
@@ -37,9 +38,11 @@ class EsAsyncBaseFiltersClient(AsyncBaseFiltersClient):
37
38
  Returns:
38
39
  Dict[str, Any]: A dictionary containing the queryables for the given collection.
39
40
  """
41
+ request: Optional[Request] = kwargs.get("request")
42
+ url_str: str = str(request.url) if request else ""
40
43
  queryables: Dict[str, Any] = {
41
- "$schema": "https://json-schema.org/draft/2019-09/schema",
42
- "$id": "https://stac-api.example.com/queryables",
44
+ "$schema": "https://json-schema.org/draft-07/schema",
45
+ "$id": f"{url_str}",
43
46
  "type": "object",
44
47
  "title": "Queryables for STAC API",
45
48
  "description": "Queryable names for the STAC API Item Search filter.",
@@ -49,7 +52,7 @@ class EsAsyncBaseFiltersClient(AsyncBaseFiltersClient):
49
52
  if not collection_id:
50
53
  return queryables
51
54
 
52
- properties: Dict[str, Any] = queryables["properties"]
55
+ properties: Dict[str, Any] = queryables["properties"].copy()
53
56
  queryables.update(
54
57
  {
55
58
  "properties": properties,
@@ -28,6 +28,8 @@ Function Naming Conventions:
28
28
  import os
29
29
  from typing import Any, Dict, Literal, Protocol
30
30
 
31
+ from stac_fastapi.core.utilities import get_bool_env
32
+
31
33
 
32
34
  # stac_pydantic classes extend _GeometryBase, which doesn't have a type field,
33
35
  # So create our own Protocol for typing
@@ -134,7 +136,7 @@ ES_ITEMS_MAPPINGS = {
134
136
  "id": {"type": "keyword"},
135
137
  "collection": {"type": "keyword"},
136
138
  "geometry": {"type": "geo_shape"},
137
- "assets": {"type": "object", "enabled": False},
139
+ "assets": {"type": "object", "enabled": get_bool_env("STAC_INDEX_ASSETS")},
138
140
  "links": {"type": "object", "enabled": False},
139
141
  "properties": {
140
142
  "type": "object",
@@ -162,7 +164,9 @@ ES_COLLECTIONS_MAPPINGS = {
162
164
  "extent.temporal.interval": {"type": "date"},
163
165
  "providers": {"type": "object", "enabled": False},
164
166
  "links": {"type": "object", "enabled": False},
165
- "item_assets": {"type": "object", "enabled": False},
167
+ "item_assets": {"type": "object", "enabled": get_bool_env("STAC_INDEX_ASSETS")},
168
+ # Field alias to allow sorting on 'temporal' (points to extent.temporal.interval)
169
+ "temporal": {"type": "alias", "path": "extent.temporal.interval"},
166
170
  },
167
171
  }
168
172
 
@@ -1,2 +1,2 @@
1
1
  """library version."""
2
- __version__ = "6.2.1"
2
+ __version__ = "6.4.0"
@@ -1 +0,0 @@
1
- stac-fastapi.core==6.2.1
File without changes