You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -369,6 +370,8 @@ You can customize additional settings in your `.env` file:
369
370
|`USE_DATETIME_NANOS`| Enables nanosecond precision handling for `datetime` field searches as per the `date_nanos` type. When `False`, it uses 3 millisecond precision as per the type `date`. |`true`| Optional |
370
371
|`EXCLUDED_FROM_QUERYABLES`| Comma-separated list of fully qualified field names to exclude from the queryables endpoint and filtering. Use full paths like `properties.auth:schemes,properties.storage:schemes`. Excluded fields and their nested children will not be exposed in queryables. | None | Optional |
371
372
|`EXCLUDED_FROM_ITEMS`| Specifies fields to exclude from STAC item responses. Supports comma-separated field names and dot notation for nested fields (e.g., `private_data,properties.confidential,assets.internal`). |`None`| Optional |
373
+
|`STAC_FASTAPI_ES_CUSTOM_MAPPINGS`| JSON string of custom Elasticsearch/OpenSearch property mappings to merge with defaults. See [Custom Index Mappings](#custom-index-mappings). |`None`| Optional |
374
+
|`STAC_FASTAPI_ES_DYNAMIC_MAPPING`| Controls dynamic mapping behavior for item indices. Values: `true` (default), `false`, or `strict`. See [Custom Index Mappings](#custom-index-mappings). |`true`| Optional |
Accepts a JSON string representing a properties dictionary that will be merged into the default item mappings. Custom mappings will overwrite defaults if keys collide.
### Dynamic Mapping Control (`STAC_FASTAPI_ES_DYNAMIC_MAPPING`)
747
+
748
+
Controls how Elasticsearch/OpenSearch handles fields not defined in the mapping:
749
+
750
+
| Value | Behavior |
751
+
|-------|----------|
752
+
|`true` (default) | New fields are automatically added to the mapping. Maintains backward compatibility. |
753
+
|`false`| New fields are ignored and not indexed. Documents can still contain these fields, but they won't be searchable. |
754
+
| `strict` | Documents with unmapped fields are rejected. |
755
+
756
+
### Combining Both Variables for Performance Optimization
757
+
758
+
For large datasets with extensive metadata that isn't queried, you can disable dynamic mapping and define only the fields you need:
759
+
760
+
```bash
761
+
# Disable dynamic mapping
762
+
export STAC_FASTAPI_ES_DYNAMIC_MAPPING=false
763
+
764
+
# Define only queryable fields
765
+
export STAC_FASTAPI_ES_CUSTOM_MAPPINGS='{
766
+
"properties": {
767
+
"properties": {
768
+
"platform": {"type": "keyword"},
769
+
"eo:cloud_cover": {"type": "float"},
770
+
"view:sun_elevation": {"type": "float"}
771
+
}
772
+
}
773
+
}'
774
+
```
775
+
776
+
This prevents Elasticsearch from creating mappings for unused metadata fields, reducing index size and improving ingestion performance.
777
+
778
+
> [!NOTE]
779
+
> These environment variables apply to both Elasticsearch and OpenSearch backends. Changes only affect newly created indices. For existing indices, you'll need to reindex using [SFEOS-tools](https://github.com/Healy-Hyperspatial/sfeos-tools).
780
+
781
+
> [!WARNING]
782
+
> Use caution when overriding core fields like `geometry`, `datetime`, or `id`. Incorrect types may cause search failures or data loss.
0 commit comments