Skip to content

Commit 3a9f076

Browse files
committed
add es_os_refresh env var
1 parent b8d6c38 commit 3a9f076

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,11 @@ You can customize additional settings in your `.env` file:
111111
| `RELOAD` | Enable auto-reload for development. | `true` | Optional |
112112
| `STAC_FASTAPI_RATE_LIMIT` | API rate limit per client. | `200/minute` | Optional |
113113
| `BACKEND` | Tests-related variable | `elasticsearch` or `opensearch` based on the backend | Optional |
114-
| `ELASTICSEARCH_VERSION` | Version of Elasticsearch to use. | `8.11.0` | Optional |
115-
| `ENABLE_DIRECT_RESPONSE` | Enable direct response for maximum performance (disables all FastAPI dependencies, including authentication, custom status codes, and validation) | `false` | Optional |
114+
| `ELASTICSEARCH_VERSION` | Version of Elasticsearch to use. | `8.11.0` | Optional | |
116115
| `OPENSEARCH_VERSION` | OpenSearch version | `2.11.1` | Optional
117-
| `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 |
116+
| `ENABLE_DIRECT_RESPONSE` | Enable direct response for maximum performance (disables all FastAPI dependencies, including authentication, custom status codes, and validation) | `false` | Optional
117+
| `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 |
118+
| `ES_OS_REFRESH` | Controls whether Elasticsearch/OpenSearch 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. | `false` | Optional |
118119

119120
> [!NOTE]
120121
> The variables `ES_HOST`, `ES_PORT`, `ES_USE_SSL`, and `ES_VERIFY_CERTS` 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.

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class ElasticsearchSettings(ApiSettings, ApiBaseSettings):
8787
enable_response_models: bool = False
8888
enable_direct_response: bool = get_bool_env("ENABLE_DIRECT_RESPONSE", default=False)
8989
raise_on_bulk_error: bool = get_bool_env("RAISE_ON_BULK_ERROR", default=False)
90+
es_os_refresh: bool = get_bool_env("ES_OS_REFRESH", default=False)
9091

9192
@property
9293
def create_client(self):

stac_fastapi/opensearch/stac_fastapi/opensearch/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ class AsyncOpensearchSettings(ApiSettings, ApiBaseSettings):
105105
enable_response_models: bool = False
106106
enable_direct_response: bool = get_bool_env("ENABLE_DIRECT_RESPONSE", default=False)
107107
raise_on_bulk_error: bool = get_bool_env("RAISE_ON_BULK_ERROR", default=False)
108+
es_os_refresh: bool = get_bool_env("ES_OS_REFRESH", default=False)
108109

109110
@property
110111
def create_client(self):

0 commit comments

Comments
 (0)