File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
stac_fastapi/elasticsearch/stac_fastapi/elasticsearch Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -18,27 +18,30 @@ def _es_config() -> Dict[str, Any]:
18
18
# Initialize the configuration dictionary
19
19
config = {
20
20
"hosts" : hosts ,
21
- "headers" : {"accept" : "application/vnd.elasticsearch+json; compatible-with=7" }
21
+ "headers" : {"accept" : "application/vnd.elasticsearch+json; compatible-with=7" },
22
22
}
23
23
24
24
# Explicitly exclude SSL settings when not using SSL
25
25
if not use_ssl :
26
26
return config
27
27
28
28
# Include SSL settings if using https
29
- config ["ssl_version" ] = ssl .TLSVersion .TLSv1_2
30
- config ["verify_certs" ] = os .getenv ("ES_VERIFY_CERTS" , "true" ).lower () != "false"
29
+ config ["ssl_version" ] = ssl .TLSVersion .TLSv1_2 # type: ignore
30
+ config ["verify_certs" ] = os .getenv ("ES_VERIFY_CERTS" , "true" ).lower () != "false" # type: ignore
31
31
32
32
# Include CA Certificates if verifying certs
33
33
if config ["verify_certs" ]:
34
- config ["ca_certs" ] = os .getenv ("CURL_CA_BUNDLE" , "/etc/ssl/certs/ca-certificates.crt" )
34
+ config ["ca_certs" ] = os .getenv (
35
+ "CURL_CA_BUNDLE" , "/etc/ssl/certs/ca-certificates.crt"
36
+ )
35
37
36
38
# Handle authentication
37
39
if (u := os .getenv ("ES_USER" )) and (p := os .getenv ("ES_PASS" )):
38
40
config ["http_auth" ] = (u , p )
39
41
40
42
return config
41
43
44
+
42
45
_forbidden_fields : Set [str ] = {"type" }
43
46
44
47
Original file line number Diff line number Diff line change @@ -170,12 +170,19 @@ def indices(collection_ids: Optional[List[str]]) -> str:
170
170
171
171
172
172
async def create_collection_index () -> None :
173
+ """
174
+ Create the index for a Collection.
175
+
176
+ Returns:
177
+ None
178
+
179
+ """
173
180
client = AsyncElasticsearchSettings ().create_client
174
181
175
182
await client .options (ignore_status = 400 ).indices .create (
176
183
index = f"{ COLLECTIONS_INDEX } -000001" ,
177
184
aliases = {COLLECTIONS_INDEX : {}},
178
- mappings = ES_COLLECTIONS_MAPPINGS
185
+ mappings = ES_COLLECTIONS_MAPPINGS ,
179
186
)
180
187
await client .close ()
181
188
You can’t perform that action at this time.
0 commit comments