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]:
1818 # Initialize the configuration dictionary
1919 config = {
2020 "hosts" : hosts ,
21- "headers" : {"accept" : "application/vnd.elasticsearch+json; compatible-with=7" }
21+ "headers" : {"accept" : "application/vnd.elasticsearch+json; compatible-with=7" },
2222 }
2323
2424 # Explicitly exclude SSL settings when not using SSL
2525 if not use_ssl :
2626 return config
2727
2828 # 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
3131
3232 # Include CA Certificates if verifying certs
3333 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+ )
3537
3638 # Handle authentication
3739 if (u := os .getenv ("ES_USER" )) and (p := os .getenv ("ES_PASS" )):
3840 config ["http_auth" ] = (u , p )
3941
4042 return config
4143
44+
4245_forbidden_fields : Set [str ] = {"type" }
4346
4447
Original file line number Diff line number Diff line change @@ -170,12 +170,19 @@ def indices(collection_ids: Optional[List[str]]) -> str:
170170
171171
172172async def create_collection_index () -> None :
173+ """
174+ Create the index for a Collection.
175+
176+ Returns:
177+ None
178+
179+ """
173180 client = AsyncElasticsearchSettings ().create_client
174181
175182 await client .options (ignore_status = 400 ).indices .create (
176183 index = f"{ COLLECTIONS_INDEX } -000001" ,
177184 aliases = {COLLECTIONS_INDEX : {}},
178- mappings = ES_COLLECTIONS_MAPPINGS
185+ mappings = ES_COLLECTIONS_MAPPINGS ,
179186 )
180187 await client .close ()
181188
You can’t perform that action at this time.
0 commit comments