A STAC API Opensearch server built with Rust
This project would not be possible without the contributors to stac-fastapi and stac-fastapi-elasticsearch-opensearch — it's a port of their ideas and hard work to Rust.
The following organizations have contributed time and/or funding to support the development of this project:
-
11/21/2026: ⚡ Raw
RawValueread path lands (PR #31) — item reads (/search,/catalogs/{id}/search, and both items listings) now decode OpenSearch hits asserde_json::value::RawValueenvelopes:geometry,properties, andassetsare never DOM-parsed on the way out. Docs with no storedlinks, nofieldsfilter, and no field exclusions get their generatedlinksspliced in textually. Measured on the standardstac-api-load-testingworkload (4 collections, 2,000 items, 8 locust workers): ~17% more requests/sec at every concurrency level (2,268 vs 1,931 rps at 100 users) with p99 latency ~18% lower — and ~35% faster handler-side on heavy ~100 KB items. The same change fixed items listings silently overwritinglinks— discarding stored user links likelicense— they now merge exactly like/search. -
11/05/2026: 🦀 stac-os-rs — SFEOS in Rust! Work has begun on stac-os-rs, a Rust implementation of this API. In early benchmarking with stac-api-load-testing it already serves roughly 2.2× the throughput of stac-fastapi-opensearch (sfeos) and ~8.7× stac-fastapi-pgstac on the same dataset and workload — about 2,200 requests/sec vs ~1,000 at 50 concurrent users with zero failures — and its p99 latency is below stac-fastapi-opensearch's median. It's early days; follow the repo for progress. At ~8.7× the throughput of stac-fastapi-pgstac, the Rust + OpenSearch combination can serve the same workload on a fraction of the hardware — which is both an environmental and an economic argument for switching. It's also worth noting that sfeos itself was already ~4× faster than stac-fastapi-pgstac in these runs.
View Older News (Click to Expand)
- What is this?
- API Routes
- Getting Started (coming from Python?)
- Extending (custom routes)
- Sample Data
- Load Testing
- TODO
- Conformance Matrix
- Changelog
A Rust port of sfeos — the STAC API implementation backed by OpenSearch — with the same extensions surface (Fields, Query, Filter/CQL2, Sort, Queryables, Sortables, transactions, collections-search). The upstream Python test suite is vendored under tests/upstream/ and runs against this server over HTTP, so behavior stays compatible.
sfeos also supports the multi-tenant-catalogs extension, which this project implements too: catalogs form a poly-hierarchy (a DAG — a catalog or collection can live under multiple parents), and every STAC capability is exposed scoped under /catalogs/{catalog_id} rather than only at the API root. It's an optional extension — the catalogs surface is mounted by default; set ENABLE_CATALOGS_ROUTE=false to unmount it (upstream's same-named flag is opt-in; this port makes it opt-out). See API Routes for the full surface.
The catalog DAG is stored in OpenSearch as one {kind, parents} document per node (stac-hierarchy index) — children are derived via term queries on parents, so linking a shared resource is a single-document write, and orphans are automatically adopted under root.
The multi-tenant-catalogs extension includes a transaction spec, which this project implements: full create/update/delete of catalogs, collections, and items inside the /catalogs scope (multi-tenant-catalogs/transaction conformance class). All write endpoints are gated behind a flag:
ENABLE_TRANSACTIONS_EXTENSIONS=true # unsets → every mutating route returns 405When unset, only the read surface is mounted and the landing page conformsTo omits the transaction conformance URIs.
Core STAC routes
| Method | Path | Supports |
|---|---|---|
| GET | / |
Landing page (conformsTo, child links per root node, search/data/conformance/service-desc/service-doc links) |
| GET | /conformance |
OGC conformance class URIs |
| GET | /api |
OpenAPI service description (service-desc link target) |
| GET | /api.html |
Swagger UI service documentation (service-doc link target) |
| GET | /docs |
Alias for /api.html (FastAPI-style Swagger UI) |
| GET | /_mgmt/ping |
Health check — {"message":"PONG"} |
| GET | /sortables |
OGC Sortables schema for sortby discovery |
| GET | /queryables |
OGC Queryables JSON Schema — core item fields (application/schema+json) |
| GET/POST | /search |
Registry-wide item search (same handler as /catalogs/search). Filters: collections, ids, bbox, intersects, datetime, sortby, limit, token (search_after cursor; numeric = offset sugar), fields, query, filter, q (free text) → next/prev links |
| GET | /children |
Children extension — root-level catalogs + collections ({children, links}); ?type=Catalog|Collection, ?limit=&token=, filter + filter-lang. Always mounted: collections-only when ENABLE_CATALOGS_ROUTE is off |
| GET | /collections |
?limit=&token= paging — every collection in the registry. Collections-search extensions: sortby, fields, q (free text), filter + filter-lang, query, datetime, bbox |
| GET/POST | /collections-search |
Requires ENABLE_COLLECTIONS_SEARCH_ROUTE. Same parameter surface as extended /collections; POST takes {sortby:[{field,direction}], fields:{include,exclude}, q, filter, query, datetime, bbox, limit, token} — next links carry body.token |
| GET | /collections-sortables |
Sortables schema for collections-search (mounted when either collections-search flag is on) |
| GET | /collections/{collection_id} |
Canonical links (self, parent per parent, duplicate, queryables) |
| GET | /collections/{collection_id}/sortables |
Per-collection Sortables schema (ogcapi-features-5 binding) |
| GET | /collections/{collection_id}/queryables |
Per-collection Queryables — core fields merged with the items index mapping; platform.enum populated from indexed values |
| GET | /collections/{collection_id}/items |
?limit=&token= paging; ?sortby=±field; ?fields= filtering; ?q= free text (FREE_TEXT_FIELDS); filter, query, bbox, datetime, ids; application/geo+json, item self/parent/collection/root links |
| GET | /collections/{collection_id}/items/{item_id} |
application/geo+json |
Multi-tenant catalogs routes — mounted only while ENABLE_CATALOGS_ROUTE is on (the default)
| Method | Path | Supports |
|---|---|---|
| GET | /catalogs |
Flat list of every catalog (incl. nested, with parent links); ?limit=&token= paging (default 10); filter + filter-lang (cql2) |
| GET | /catalogs/{catalog_id} |
Dynamic links (parent per parent, children, data, search) |
| GET | /catalogs/{catalog_id}/catalogs |
?limit=&token= paging; filter + filter-lang |
| GET | /catalogs/{catalog_id}/conformance |
Scoped conformsTo classes |
| GET | /catalogs/{catalog_id}/queryables |
Scoped Queryables schema |
| GET | /catalogs/{catalog_id}/children |
?type=Catalog|Collection filter, ?limit=&token= paging; filter + filter-lang |
| GET | /catalogs/{catalog_id}/collections |
?limit=&token= paging; ?sortby=±field (mapping-driven sortables), ?fields=±field projection, ?q= free text, filter + filter-lang |
| GET | /catalogs/{catalog_id}/collections/{collection_id} |
Contextual self/parent, alt parents as related/duplicate |
| GET | /catalogs/{catalog_id}/collections/{collection_id}/items |
?limit=&token= paging; ?sortby=±field; ?fields= filtering; ?q= free text (FREE_TEXT_FIELDS); filter, query, bbox, datetime, ids; application/geo+json, scoped item links |
| GET | /catalogs/{catalog_id}/collections/{collection_id}/items/{item_id} |
application/geo+json |
| GET/POST | /catalogs/search |
Whole-registry scope. Same filters as /search |
| GET/POST | /catalogs/{catalog_id}/search |
Same filters, intersected with the catalog's descendant collections |
GET search takes collections, ids, bbox, datetime, intersects (URL-encoded GeoJSON), limit, token, sortby (+field/-field shorthand), fields (comma-separated, - prefix excludes), q (comma-separated free-text terms, OR'd), query (JSON-encoded STACQL), filter + filter-lang (cql2-text/cql2-json), and filter-crs as query params; POST takes the full Search body (intersects, fields: {include, exclude}, query, filter + filter-lang — defaults to cql2-json). A bbox crossing the antimeridian (xmin > xmax) is supported — internally rewritten as a ±180°-split MultiPolygon intersects query.
fields implements the Fields extension: include/exclude with nested paths (properties.datetime) and * wildcards (properties.eo:*); when an include selection matches nothing, items fall back to {id, collection} per spec.
query implements the Query extension — {"eo:cloud_cover": {"lt": 10}} with eq/ne/neq/gt/gte/lt/lte/in/contains; bare property names resolve under properties.* (top-level fields like id/collection pass through).
filter implements the Filter extension — CQL2 in both cql2-json (POST) and cql2-text (GET) forms. Coverage: basic-cql2 (comparisons, and/or/not, IS NULL), advanced comparisons (LIKE, BETWEEN, IN), and basic spatial predicates (s_intersects/s_within/s_contains/s_disjoint). Temporal functions and arithmetic are not yet supported — unsupported operators return 400.
Core transactions — canonical /collections surface (STAC Transaction extension / OGC API Features Part-4 style)
| Method | Path | Supports |
|---|---|---|
| POST | /collections |
Create under root; 409 on id collision |
| PUT | /collections/{collection_id} |
Update; 400 id mismatch, 404 missing; DAG memberships preserved |
| PATCH | /collections/{collection_id} |
JSON Merge Patch (application/merge-patch+json) or RFC 6902 JSON Patch (application/json-patch+json); 400 immutable id change |
| DELETE | /collections/{collection_id} |
Delete collection and its items; 404 if missing |
| POST | /collections/{collection_id}/items |
Create; 404 missing collection, 409 repost, 400 collection mismatch. FeatureCollection body = batch create (all-or-nothing 400 if any feature mismatches) |
| POST | /collections/{collection_id}/bulk_items |
Bulk insert/update {"items": {...}}; reports {received, success, skipped, errors[]} |
| PUT | /collections/{collection_id}/items/{item_id} |
Update; 404 missing item/collection, 400 id mismatch |
| PATCH | /collections/{collection_id}/items/{item_id} |
Merge Patch / JSON Patch; 400 immutable id/collection change |
| DELETE | /collections/{collection_id}/items/{item_id} |
Delete; 404 unless item is in this collection |
Catalog transactions — Multi-Tenant Catalogs extension (scoped, poly-hierarchy)
| Method | Path | Supports |
|---|---|---|
| POST | /catalogs |
Create a root-level catalog; 409 on id collision |
| PUT | /catalogs/{catalog_id} |
Update; body id must match path |
| DELETE | /catalogs/{catalog_id} |
Disband — direct children adopted by root, never cascaded |
| POST | /catalogs/{catalog_id}/catalogs |
Mode A full-body create (201) or Mode B link {"id": ...} (200); 404 link target missing, 409 repost |
| DELETE | /catalogs/{catalog_id}/catalogs/{sub_id} |
Unlink edge only; 404 if not a child |
| POST | /catalogs/{catalog_id}/collections |
Mode A create / Mode B link — same codes as sub-catalogs |
| PUT | /catalogs/{catalog_id}/collections/{collection_id} |
Update in place — all DAG memberships preserved |
| DELETE | /catalogs/{catalog_id}/collections/{collection_id} |
Unlink edge only; 404 if not a child (does not delete the collection) |
| POST | /catalogs/{catalog_id}/collections/{collection_id}/items |
Create; 400 if body collection contradicts path |
| PUT | /catalogs/{catalog_id}/collections/{collection_id}/items/{item_id} |
Update; same collection check |
| DELETE | /catalogs/{catalog_id}/collections/{collection_id}/items/{item_id} |
Delete; 404 unless in this collection |
Scoped reads 404 when the target collection isn't inside the catalog's DAG. Item payloads whose collection field contradicts the path get a 400.
Status codes: 201 create (Mode A), 200 link (Mode B {"id": ...}) / update, 204 delete/unlink, 400 bad request (limit=0, id mismatch, invalid search), 404 missing resource or edge, 409 id collision / full-body repost, 412 failed If-Match precondition.
Optimistic concurrency (ETag/If-Match): single-resource GET and write responses carry a strong ETag ("<primary_term>-<seq_no>-<indexhash>", suffixed -gzip/-br when the body is compressed — RFC 9110 §8.8.1). PUT/PATCH/DELETE honor If-Match (*, tag lists, weak/malformed tags never match); the checked version conditions the write itself, so check-and-write is atomic (409→412 on a lost race).
Rust projects don't use pip or virtualenvs — dependencies live in Cargo.toml (like pyproject.toml) and are fetched automatically by cargo, the Rust build/package tool.
1. Install the Rust toolchain (gives you cargo, think "pip + interpreter in one"):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source ~/.cargo/env
cargo --version # verify install2. Start the stack — compose.yml runs the API, a single-node OpenSearch dev cluster, and Dashboards:
docker compose up -d # API :3000, OpenSearch :9200, Dashboards :5601Just want to run it, not hack on it?
compose.release.ymlpulls the published image (ghcr.io/staclabs/stac-os-rs) instead of building from source — no Rust toolchain or repo checkout needed:docker compose -f compose.release.yml up -d # API :3000, OpenSearch :9200
3. Or run the API locally — iterate on Rust code while OpenSearch stays in Docker:
docker compose up -d opensearch
cargo run # API on http://localhost:3000All variables are read once at startup — changing them requires a restart.
Backend Connection
| Variable | Description | Default | Required |
|---|---|---|---|
OPENSEARCH_URL |
OpenSearch endpoint the store connects to. | http://localhost:9200 |
Optional |
STAC_PORT |
TCP port the API binds to (0.0.0.0:{port}). |
3000 |
Optional |
STAC_BASE_URL |
External base URL used for advertised links (self, root, next, queryables/sortables $ids) — set this behind a reverse proxy so links point at the public origin rather than the bind address. |
http://localhost:{port} |
Optional |
Feature Flags
| Variable | Description | Default | Required |
|---|---|---|---|
ENABLE_TRANSACTIONS_EXTENSIONS |
Mounts all mutating routes — POST/PUT/PATCH/DELETE on collections and items, bulk_items, and the /catalogs transaction surface. The read surface is always mounted. Set to true in compose.yml. |
false |
Optional |
CATALOGS_HIDE_ALTERNATE_PARENTS |
Suppresses related/duplicate links and extra parent links for alternate parents in poly-hierarchy — only the contextual parent is advertised. Useful for multi-tenant deployments. (Upstream calls this HIDE_ALTERNATE_PARENTS.) |
false |
Optional |
ENABLE_COLLECTIONS_SEARCH |
Enables the collection search extensions (sortby, fields, q, filter, query, datetime, bbox) on GET /collections. false = plain limit/token listing, params ignored. |
true |
Optional |
ENABLE_COLLECTIONS_SEARCH_ROUTE |
Mounts the GET/POST /collections-search route. Set to true in compose.yml (upstream default is off). |
false |
Optional |
ENABLE_CATALOGS_ROUTE |
Mounts the whole /catalogs/** surface — registry, scoped collections/items/search reads and (with transactions on) catalog/scoped writes. false unmounts it and strips the catalogs link, catalog child links, related/duplicate scoped links, and the multi-tenant-catalogs/children#type-filter conformance URIs (v1.0.0/children and GET /children stay — the root listing goes collections-only); core routes are unaffected. Upstream's flag is opt-in — this port defaults it on. |
true |
Optional |
ENABLE_STAC_VALIDATOR |
Validates write bodies against STAC JSON schemas before they reach OpenSearch — item/collection/catalog POST and PUT bodies, each member of a FeatureCollection or bulk_items batch, and the merged result of PATCH. Items are validated in read shape (the API injects collection, assets, and generated links clients aren't required to supply). Invalid docs return 400 with Invalid item: STAC validation failed for '{id}': ...; unknown stac_version values are rejected up front, a schema that doesn't exist (404) returns 400, and other extension-schema fetch failures or timeouts return 502. Core schemas are bundled; schemas for stac_extensions entries are fetched and cached on first use. Also enables the upstream datetime-range checks (start_datetime/end_datetime pairing and ordering) — failures return 400 with Invalid item datetime: .... |
false |
Optional |
ENABLE_TOPOLOGY_VALIDATION |
Geometry sanity checks beyond the JSON schema: every coordinate must be within WGS84 bounds (lon ±180, lat ±90), Polygon/MultiPolygon rings need ≥4 points and must not cross the antimeridian (>180° longitude jumps between consecutive vertices). Failures return 400 with Invalid item geometry: ... (Topology Error: ... inside batch errors[]). |
false |
Optional |
RAISE_ON_BULK_ERROR |
Strict batch writes. false (upstream default): FeatureCollection POSTs and bulk_items inserts are partial — valid members land, failures are reported per-item (conflict_errors/errors[]), and the response stays 201/200. true: any malformed member, schema failure, or conflict rejects the whole batch (400/409). |
false |
Optional |
MAX_BATCH_ERROR_SIZE |
Validation-error ceiling for batch members — once exceeded the whole batch is rejected with 400 regardless of RAISE_ON_BULK_ERROR ("Validation error threshold exceeded"). Unset = no limit. |
none | Optional |
VALIDATOR_POOL_SIZE |
Max batch members validated concurrently. Since stac-validate 0.6.16 there is a single shared Validator (interior OnceCell schema cache deduplicates concurrent fetches of the same extension schema — a failed fetch isn't cached and retries on the next validation); this bounds the parallelism of batch-member validation, not a pool of instances. Kept under the historical env name. |
4 |
Optional |
MAX_TOPOLOGY_VERTICES |
Maximum vertices per Polygon/MultiPolygon ring when ENABLE_TOPOLOGY_VALIDATION is on — a runaway ring is rejected before it can stall indexing. |
5000 |
Optional |
Limits & Performance
| Variable | Description | Default | Required |
|---|---|---|---|
STAC_DEFAULT_COLLECTION_LIMIT |
Default page size for /collections and /collections-search when limit isn't given. |
10 |
Optional |
STAC_GLOBAL_COLLECTION_MAX_LIMIT |
Hard cap on collection page size — larger limit values clamp to this. |
none | Optional |
STAC_DEFAULT_ITEM_LIMIT |
Default page size for item listings and /search when limit isn't given. |
10 |
Optional |
STAC_GLOBAL_ITEM_MAX_LIMIT |
Hard cap on item page size — larger limit values clamp to this. |
none | Optional |
Filtering & Exclusions
| Variable | Description | Default | Required |
|---|---|---|---|
EXCLUDED_FROM_ITEMS |
Comma-separated field paths stripped from every item response (e.g. private_data,properties.confidential). Applied before the request's own fields filter — privacy wins over includes. |
none | Optional |
EXCLUDED_FROM_QUERYABLES |
Comma-separated field paths excluded from /queryables output; nested children are excluded with them. |
none | Optional |
Database Indexing & Behavior
| Variable | Description | Default | Required |
|---|---|---|---|
USE_DATETIME |
false = items carrying start_datetime/end_datetime are datetime-filtered on the range alone, ignoring properties.datetime (matches upstream USE_DATETIME=false query semantics). |
true |
Optional |
DATABASE_REFRESH |
Refresh policy on writes: false accepts up-to-refresh_interval search lag (GET-by-id stays real-time) — the fast ingest setting; true refreshes inline before responding; wait_for parks until the next refresh tick. Hierarchy link/unlink and PATCH writes force true regardless — they need same-flow read-after-write (upstream patch_item forces it too). compose.yml sets true, mirroring sfeos's own compose override. |
false |
Optional |
FREE_TEXT_FIELDS |
Comma-separated multi_match field list for item free-text q (/search, /catalogs/*/search, /collections/{id}/items) — boost syntax allowed (e.g. properties.title^3,properties.my_field). Set this to search custom properties. |
id, collection, properties.title^3, properties.description, properties.keywords |
Optional |
REQUIRE_IF_MATCH |
true = writes that accept an If-Match precondition require the header — a missing one returns 428 (checked before body parsing/validation). |
false |
Optional |
Upstream sfeos env vars not yet wired — planned but currently inert if set: ENABLE_REDIS_QUEUE/VALIDATE_BEFORE_QUEUE (async writes), MAX_BATCH_SIZE (chunked batch writes), custom-mapping/sort-remap vars, and the ES_* connection family (we take a single OPENSEARCH_URL).
Other handy commands: cargo check (fast type-check, no binary), cargo test (unit + integration tests — integration tests need OpenSearch running, and skip automatically if it's not), cargo add <crate> (add a dependency).
Or use the Makefile, which handles the Docker dependency for you (make test / make test-integration start OpenSearch and wait for it to be healthy before running tests): make up, make test, make test-integration, make test-upstream (vendored upstream API suite against localhost:3000), make ingest, make reset (wipes data volumes), make down.
Spec conformance: make validate runs stac-api-validator (pip install stac-api-validator first) — needs the API running with make up and data via make ingest. Checks core, item-search, features, and browseable classes.
stac-os-rs is usable as a library — the router is composable axum, so consumers merge their own extension routes sharing the same AppState (store, link engine, config). Three seams:
stac_os_rs::read_router()/transaction_router()(pluscatalogs_read_router()/catalogs_transaction_router()for the multi-tenant surface) — mount selectively (e.g. transactions behind auth middleware), orbuild_app(state)for the whole surfacehandlers::AppStatefields are public — your handlers can takeState<Arc<AppState>>and callstate.store.*directly- Standard axum composition:
.merge()extra routes,.layer()middleware
use axum::{extract::State, routing::get, Json, Router};
use serde_json::json;
use stac_os_rs::{handlers::AppState, read_router, store::ROOT_CATALOG_ID};
use std::sync::Arc;
async fn stats(State(state): State<Arc<AppState>>) -> Json<serde_json::Value> {
let children = state.store.get_children(ROOT_CATALOG_ID).await.unwrap_or_default();
Json(json!({ "root_children": children.len() }))
}
let state = Arc::new(AppState { /* store, links, base_url, flags */ });
let app = read_router()
.merge(Router::new().route("/stats", get(stats)))
.with_state(state);Anything middleware-shaped (auth, CORS, rate-limiting) goes through .layer() — no fork needed.
sample_data/ contains a demo hierarchy — folder structure mirrors the DAG:
earth-observation/ # root catalog
├── landsat/ # sub-catalog
│ └── landsat-c2-l2/ # collection + 2 items
└── sentinel/
└── sentinel-2-l2a/ # collection + 2 items
climate-research/ # root catalog
└── era5/
└── era5-daily/ # collection + 2 items
Load it (requires ENABLE_TRANSACTIONS_EXTENSIONS, on by default in compose.yml):
python3 scripts/ingest_sample_data.py # STAC_API_URL to override :3000Then try scoped search: POST /catalogs/earth-observation/search returns its 4 satellite items; POST /catalogs/search searches the whole registry.
Benchmarked against stac-fastapi-os (the Python sfeos upstream) and stac-fastapi-pgstac using staclabs/stac-api-load-testing — same Locust workload against all three, 1,000 items each, DATABASE_REFRESH=true on both OpenSearch backends.
v0.5.0, 0 failures across all runs:
| backend | users | reqs | fails | med (ms) | p95 | p99 | rps |
|---|---|---|---|---|---|---|---|
| stac-fastapi-pgstac | 10 | 14,188 | 0 | 16 | 130 | 160 | 236 |
| stac-fastapi-pgstac | 50 | 16,351 | 0 | 33 | 670 | 2,200 | 272 |
| stac-fastapi-pgstac | 100 | 16,450 | 0 | 62 | 1,300 | 4,600 | 274 |
| stac-fastapi-os | 10 | 57,608 | 0 | 6 | 22 | 36 | 960 |
| stac-fastapi-os | 50 | 70,668 | 0 | 37 | 81 | 120 | 1,177 |
| stac-fastapi-os | 100 | 72,076 | 0 | 72 | 140 | 180 | 1,200 |
| stac-os-rs | 10 | 123,832 | 0 | 3 | 9 | 11 | 2,063 |
| stac-os-rs | 50 | 168,329 | 0 | 15 | 31 | 39 | 2,803 |
| stac-os-rs | 100 | 166,015 | 0 | 31 | 55 | 68 | 2,765 |
~2.3× the upstream Python backend's throughput and ~10× stac-fastapi-pgstac's, with the worst p99 (68ms at 100 users) still below stac-fastapi-os's median at the same concurrency. Numbers are from a single-node dev cluster — treat as relative, not absolute.
This is a prototype — the endpoints exist but several are shallow. Known gaps:
Search
collections,ids,bbox(incl. antimeridian crossing),intersects,datetime,sortby,limit,fields,query(STACQL), andfilter(CQL2 json + text) are appliedfiltercoverage is basic-cql2 + advanced comparisons + basic spatial predicates — temporal functions (t_*), arithmetic, and array ops are not yet supported (400)sortbyworks on/search+/catalogs/*/search(item-search binding), on items listings?sortby=±field(features binding), and on/collections+/collections-search; sortables at/sortables+/collections/{id}/sortables+/collections-sortables- Collections-search extension is on:
/collectionsand/collections-search(GET+POST) supportsortby,fields,qfree text, CQL2filter, STACQLquery,datetime(temporal-extent overlap), andbbox(geo_shape on the derivedbbox_shapefield — injected at write time, stripped on read) datetimebounds require full RFC3339 date-times — date-only inputs (2023-06-01) 400, matching the spec and upstream. Accepting them as whole-day intervals (OGC Features' leniency) would be a client-friendliness enhancement: normalize bounds toT00:00:00Z/T23:59:59.999Zbeforevalid()runs — OpenSearch'sdatemapping already accepts date-only- Item paging uses
search_aftercursors (upstreamexecute_search):next/prevlinks carry a base64 JSONtokenof the page edge's sort values (in the href for GET, inbodyfor POST), and alimit + 1lookahead detects the next page — so paging continues past the 10kindex.max_result_window.previs a stateless reverse-direction cursor (flipped sort + remappedmissing), where upstream needs Redis. Item tokens are strict — not a list of exactly the sort's arity is a 400Invalid pagination token., even on an empty scope (upstream #935); a numerictoken/{offset: n}in a POST body still acts as a rawfromoffset (local sugar —sizeclamps to the window, so the edge yields a short page, not an error). Tokens are positional sort values: replaying one under a differentsortbyof the same arity is accepted but paginates on the wrong fields (same caveat as upstream), and atlimit= 10k the lookahead slot can't fit the window, so a full page counts as "maybe more" — an exact-boundary final page can emit anextthat resolves empty. Catalog/collection/children listings keep offset cursors — lenient (unknown values restart at page 1, matching upstream). All paged responses includenumberMatched/numberReturned
Core STAC routes
GET /queryables(root) serves upstream's core queryables set; per-collection queryables merge that with the items index mapping (platform.enumcomes from a terms aggregation). True per-collection narrowing would need per-collection indicesservice-docexists at/api.html(Swagger UI) alongside/apiOpenAPI JSON- The OpenAPI doc is generated at runtime from
#[utoipa::path]annotations (src/docs.rs+ per-handler attributes insrc/handlers/) —info.versionsyncs fromCargo.toml. New routes need an annotation or they won't appear in the spec
Hierarchy & data
- Children/descendants capped at 10k per level — real pagination needed on the DAG itself
- Reserved IDs: catalog ids
search(collides with the static/catalogs/searchroute) androot(the implicit root node) 400 on create/link - Orphaned docs: a hierarchy node whose document is missing is silently skipped in children listings and
rel: childlinks — needs a consistency check - User-provided
linksfollow upstreamresolve_linkssemantics — inferred structural rels (self,item,parent,collection,root,items) are stripped on write; stored user links merge with generated links on read
Ops
- OpenSearch runs single-node with the security plugin disabled — dev only, harden before anything else
- No auth or per-tenant authorization — catalog scope is organizational only, not a security boundary
Concurrency — all writes use optimistic concurrency via OpenSearch _seq_no/_primary_term: document PUTs re-stamp and retry up to 5 times (Store::replace_document/put_document), hierarchy link/unlink replay the edge mutation on a fresh read (Store::mutate_node), and POSTs use op_type=create for atomic repost-409s. Exhausted retries surface as HTTP 409.
Tests — tests/catalogs.rs ports stac-fastapi-elasticsearch-opensearch's test_catalogs.py (118 passing, 2 #[ignore]d pending: stac-validate, user-link merge semantics). tests/upstream/ vendors upstream's Python API suite verbatim — make test-upstream runs it over HTTP against localhost:3000 (needs the API up with ENABLE_TRANSACTIONS_EXTENSIONS; adapter conftest skips tests needing in-process sfeos internals). CI also runs stac-api-validator (core, item-search, features, browseable — all passing) as an advisory job. Each test gets isolated it-* indices (unique Store index prefix), so tests never touch dev data — make test* sweeps it-* afterwards, or make test-clean manually.

