Skip to content

Commit af1ada9

Browse files
committed
Elasticsearch to lower index name
1 parent e384b8b commit af1ada9

File tree

2 files changed

+4
-4
lines changed
  • key-value
    • key-value-aio/src/key_value/aio/stores/elasticsearch
    • key-value-sync/src/key_value/sync/code_gen/stores/elasticsearch

2 files changed

+4
-4
lines changed

key-value/key-value-aio/src/key_value/aio/stores/elasticsearch/store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def __init__(
207207
LessCapableJsonSerializer.install_default_serializer(client=self._client)
208208
LessCapableNdjsonSerializer.install_serializer(client=self._client)
209209

210-
self._index_prefix = index_prefix
210+
self._index_prefix = index_prefix.lower()
211211
self._native_storage = native_storage
212212
self._is_serverless = False
213213

@@ -237,7 +237,7 @@ async def _setup_collection(self, *, collection: str) -> None:
237237
_ = await self._client.options(ignore_status=404).indices.create(index=index_name, mappings=DEFAULT_MAPPING, settings={})
238238

239239
def _get_index_name(self, collection: str) -> str:
240-
return self._index_prefix + "-" + self._collection_sanitization.sanitize(value=collection)
240+
return self._index_prefix + "-" + self._collection_sanitization.sanitize(value=collection).lower()
241241

242242
def _get_document_id(self, key: str) -> str:
243243
return self._key_sanitization.sanitize(value=key)

key-value/key-value-sync/src/key_value/sync/code_gen/stores/elasticsearch/store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def __init__(
176176
LessCapableJsonSerializer.install_default_serializer(client=self._client)
177177
LessCapableNdjsonSerializer.install_serializer(client=self._client)
178178

179-
self._index_prefix = index_prefix
179+
self._index_prefix = index_prefix.lower()
180180
self._native_storage = native_storage
181181
self._is_serverless = False
182182

@@ -206,7 +206,7 @@ def _setup_collection(self, *, collection: str) -> None:
206206
_ = self._client.options(ignore_status=404).indices.create(index=index_name, mappings=DEFAULT_MAPPING, settings={})
207207

208208
def _get_index_name(self, collection: str) -> str:
209-
return self._index_prefix + "-" + self._collection_sanitization.sanitize(value=collection)
209+
return self._index_prefix + "-" + self._collection_sanitization.sanitize(value=collection).lower()
210210

211211
def _get_document_id(self, key: str) -> str:
212212
return self._key_sanitization.sanitize(value=key)

0 commit comments

Comments
 (0)