Skip to content

Commit 59661c5

Browse files
committed
Merge branch 'main' of github.com:stac-utils/stac-fastapi-elasticsearch into patch_endpoints
2 parents d171c24 + ace0c7a commit 59661c5

File tree

27 files changed

+65355
-746
lines changed

27 files changed

+65355
-746
lines changed

.github/workflows/cicd.yml

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ on:
1212
jobs:
1313
test:
1414
runs-on: ubuntu-latest
15-
timeout-minutes: 10
15+
timeout-minutes: 20
1616

1717
services:
18-
1918
elasticsearch_8_svc:
2019
image: docker.elastic.co/elasticsearch/elasticsearch:8.11.0
2120
env:
@@ -63,21 +62,25 @@ jobs:
6362
OPENSEARCH_JAVA_OPTS: -Xms512m -Xmx512m
6463
ports:
6564
- 9202:9202
65+
6666
strategy:
6767
matrix:
6868
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12"]
69+
backend: [ "elasticsearch7", "elasticsearch8", "opensearch"]
6970

70-
name: Python ${{ matrix.python-version }} testing
71+
name: Python ${{ matrix.python-version }} testing with ${{ matrix.backend }}
7172

7273
steps:
7374
- name: Check out repository code
7475
uses: actions/checkout@v4
7576

76-
# Setup Python (faster than using Python container)
7777
- name: Setup Python
7878
uses: actions/setup-python@v5
7979
with:
8080
python-version: ${{ matrix.python-version }}
81+
cache: 'pip'
82+
cache-dependency-path: |
83+
**/setup.py
8184
8285
- name: Lint code
8386
if: ${{ matrix.python-version == 3.11 }}
@@ -101,35 +104,17 @@ jobs:
101104
run: |
102105
pip install ./stac_fastapi/opensearch[dev,server]
103106
104-
- name: Run test suite against Elasticsearch 7.x
105-
run: |
106-
pipenv run pytest -svvv
107-
env:
108-
ENVIRONMENT: testing
109-
ES_PORT: 9400
110-
ES_HOST: 172.17.0.1
111-
ES_USE_SSL: false
112-
ES_VERIFY_CERTS: false
113-
BACKEND: elasticsearch
114-
115-
- name: Run test suite against Elasticsearch 8.x
107+
- name: Install pytest-timeout
116108
run: |
117-
pipenv run pytest -svvv
118-
env:
119-
ENVIRONMENT: testing
120-
ES_PORT: 9200
121-
ES_HOST: 172.17.0.1
122-
ES_USE_SSL: false
123-
ES_VERIFY_CERTS: false
124-
BACKEND: elasticsearch
109+
pip install pytest-timeout
125110
126-
- name: Run test suite against OpenSearch 2.11.1
111+
- name: Run test suite
127112
run: |
128-
pipenv run pytest -svvv
113+
pipenv run pytest -svvv --timeout=300
129114
env:
130115
ENVIRONMENT: testing
131-
ES_PORT: 9202
116+
ES_PORT: ${{ matrix.backend == 'elasticsearch7' && '9400' || matrix.backend == 'elasticsearch8' && '9200' || '9202' }}
132117
ES_HOST: 172.17.0.1
133118
ES_USE_SSL: false
134119
ES_VERIFY_CERTS: false
135-
BACKEND: opensearch
120+
BACKEND: ${{ matrix.backend == 'elasticsearch7' && 'elasticsearch' || matrix.backend == 'elasticsearch8' && 'elasticsearch' || 'opensearch' }}

CHANGELOG.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
### Changed
11+
- Support escaped backslashes in CQL2 `LIKE` queries, and reject invalid (or incomplete) escape sequences. [#286](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/286)
12+
13+
## [v3.0.0] - 2024-08-14
14+
15+
### Changed
16+
- Aggregation bug fixes [#281](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/281)
17+
- Updated stac-fastapi libraries to v3.0.0 [#282](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/282)
18+
19+
## [v3.0.0a3] - 2024-07-17
20+
1021
### Added
22+
- Added an implementation of the Aggregation Extension. Enables spatial, frequency distribution, and datetime distribution aggregations. [#276](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/276)
1123
- Added support for route depndencies configuration through the STAC_FASTAPI_ROUTE_DEPENDENCIES environment variable, directly or via json file. Allows for fastapi's inbuilt OAuth2 flows to be used as dependencies. Custom dependencies can also be written, see Basic Auth for an example. [#251](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/251)
1224
- Added docker-compose.route_dependencies_file.yml that gives an example of OAuth2 workflow using keycloak as the identity provider. [#251](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/251)
1325
- Added docker-compose.route_dependencies_env.yml that gives an example using the STAC_FASTAPI_ROUTE_DEPENDENCIES environment variable. [#251](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/251)
@@ -232,10 +244,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
232244
- Added db_to_stac serializer to item_collection method in core.py.
233245

234246

235-
[Unreleased]: <https://github.com/stac-utils/stac-fastapi-elasticsearch/tree/v3.0.0a2...main>
236-
[v3.0.0a2]: <https://github.com/stac-utils/stac-fastapi-elasticsearch/tree/v3.0.0a1...v3.0.0a2>
237-
[v3.0.0a1]: <https://github.com/stac-utils/stac-fastapi-elasticsearch/tree/v3.0.0a0...v3.0.0a1>
238-
[v3.0.0a0]: <https://github.com/stac-utils/stac-fastapi-elasticsearch/tree/v2.4.1...v3.0.0a0>
247+
[Unreleased]: <https://github.com/stac-utils/stac-fastapi-elasticsearch/tree/v3.0.0...main>
248+
[v3.0.0]: <https://github.com/stac-utils/stac-fastapi-elasticsearch/tree/v2.4.1...v3.0.0>
239249
[v2.4.1]: <https://github.com/stac-utils/stac-fastapi-elasticsearch/tree/v2.4.0...v2.4.1>
240250
[v2.4.0]: <https://github.com/stac-utils/stac-fastapi-elasticsearch/tree/v2.3.0...v2.4.0>
241251
[v2.3.0]: <https://github.com/stac-utils/stac-fastapi-elasticsearch/tree/v2.2.0...v2.3.0>

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!make
22
APP_HOST ?= 0.0.0.0
3-
EXTERNAL_APP_PORT ?= ${APP_PORT}
3+
EXTERNAL_APP_PORT ?= 8080
44

55
ES_APP_PORT ?= 8080
66
ES_HOST ?= docker.for.mac.localhost

README.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,109 @@ The modified Items with lowercase identifiers will now be visible to users acces
278278
## Auth
279279

280280
Authentication is an optional feature that can be enabled through `Route Dependencies` examples can be found and a more detailed explanation in [examples/auth](examples/auth).
281+
282+
283+
## Aggregation
284+
285+
Sfeos supports the STAC API [Aggregation Extension](https://github.com/stac-api-extensions/aggregation). This enables geospatial aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). The `/aggregate` route also fully supports base search and the STAC API [Filter Extension](https://github.com/stac-api-extensions/filter). Any query made with `/search` may also be executed with `/aggregate`, provided that the relevant aggregation fields are available,
286+
287+
288+
A field named `aggregations` should be added to the Collection object for the collection for which the aggregations are available, for example:
289+
290+
```json
291+
"aggregations": [
292+
{
293+
"name": "total_count",
294+
"data_type": "integer"
295+
},
296+
{
297+
"name": "datetime_max",
298+
"data_type": "datetime"
299+
},
300+
{
301+
"name": "datetime_min",
302+
"data_type": "datetime"
303+
},
304+
{
305+
"name": "datetime_frequency",
306+
"data_type": "frequency_distribution",
307+
"frequency_distribution_data_type": "datetime"
308+
},
309+
{
310+
"name": "sun_elevation_frequency",
311+
"data_type": "frequency_distribution",
312+
"frequency_distribution_data_type": "numeric"
313+
},
314+
{
315+
"name": "platform_frequency",
316+
"data_type": "frequency_distribution",
317+
"frequency_distribution_data_type": "string"
318+
},
319+
{
320+
"name": "sun_azimuth_frequency",
321+
"data_type": "frequency_distribution",
322+
"frequency_distribution_data_type": "numeric"
323+
},
324+
{
325+
"name": "off_nadir_frequency",
326+
"data_type": "frequency_distribution",
327+
"frequency_distribution_data_type": "numeric"
328+
},
329+
{
330+
"name": "cloud_cover_frequency",
331+
"data_type": "frequency_distribution",
332+
"frequency_distribution_data_type": "numeric"
333+
},
334+
{
335+
"name": "grid_code_frequency",
336+
"data_type": "frequency_distribution",
337+
"frequency_distribution_data_type": "string"
338+
},
339+
{
340+
"name": "centroid_geohash_grid_frequency",
341+
"data_type": "frequency_distribution",
342+
"frequency_distribution_data_type": "string"
343+
},
344+
{
345+
"name": "centroid_geohex_grid_frequency",
346+
"data_type": "frequency_distribution",
347+
"frequency_distribution_data_type": "string"
348+
},
349+
{
350+
"name": "centroid_geotile_grid_frequency",
351+
"data_type": "frequency_distribution",
352+
"frequency_distribution_data_type": "string"
353+
},
354+
{
355+
"name": "geometry_geohash_grid_frequency",
356+
"data_type": "frequency_distribution",
357+
"frequency_distribution_data_type": "numeric"
358+
},
359+
{
360+
"name": "geometry_geotile_grid_frequency",
361+
"data_type": "frequency_distribution",
362+
"frequency_distribution_data_type": "string"
363+
}
364+
]
365+
```
366+
367+
Available aggregations are:
368+
369+
- total_count (count of total items)
370+
- collection_frequency (Item `collection` field)
371+
- platform_frequency (Item.Properties.platform)
372+
- cloud_cover_frequency (Item.Properties.eo:cloud_cover)
373+
- datetime_frequency (Item.Properties.datetime, monthly interval)
374+
- datetime_min (earliest Item.Properties.datetime)
375+
- datetime_max (latest Item.Properties.datetime)
376+
- sun_elevation_frequency (Item.Properties.view:sun_elevation)
377+
- sun_azimuth_frequency (Item.Properties.view:sun_azimuth)
378+
- off_nadir_frequency (Item.Properties.view:off_nadir)
379+
- grid_code_frequency (Item.Properties.grid:code)
380+
- centroid_geohash_grid_frequency ([geohash grid](https://opensearch.org/docs/latest/aggregations/bucket/geohash-grid/) on Item.Properties.proj:centroid)
381+
- centroid_geohex_grid_frequency ([geohex grid](https://opensearch.org/docs/latest/aggregations/bucket/geohex-grid/) on Item.Properties.proj:centroid)
382+
- centroid_geotile_grid_frequency (geotile on Item.Properties.proj:centroid)
383+
- geometry_geohash_grid_frequency ([geohash grid](https://opensearch.org/docs/latest/aggregations/bucket/geohash-grid/) on Item.geometry)
384+
- geometry_geotile_grid_frequency ([geotile grid](https://opensearch.org/docs/latest/aggregations/bucket/geotile-grid/) on Item.geometry)
385+
386+
Support for additional fields and new aggregations can be added in the associated `database_logic.py` file.

0 commit comments

Comments
 (0)