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
Currently, Elasticsearch indices created through Haystack use the default cluster setting of 1 replica shard. For Haystack deployments, it's desirable to have the option to create indices with 0 replicas to optimize resource utilisation.
Proposed Change:
Modify Haystack's self._client.indices.create(index=index, body=settings) call to accept a parameter specifying the desired number of replicas. This parameter should then be incorporated into the settings body passed to the Elasticsearch API.
Example Code:
Python
class ElasticsearchDocumentStore:
def __init__(self, *, hosts: Optional[Hosts] = None, index: str = "default", number_of_replicas=0, **kwargs):
"""
Creates an Elasticsearch index with the specified number of replicas.
Args:
index (str): The name of the index to create.
number_of_replicas (int, optional): The desired number of replicas for the index. Defaults to 0.
"""
settings = {
"number_of_replicas": number_of_replicas
}
if not self._client.indices.exists(index=index):
self._client.indices.create(index=index, body=settings)
The text was updated successfully, but these errors were encountered:
Description:
Currently, Elasticsearch indices created through Haystack use the default cluster setting of 1 replica shard. For Haystack deployments, it's desirable to have the option to create indices with 0 replicas to optimize resource utilisation.
Proposed Change:
Modify Haystack's self._client.indices.create(index=index, body=settings) call to accept a parameter specifying the desired number of replicas. This parameter should then be incorporated into the settings body passed to the Elasticsearch API.
Example Code:
Python
The text was updated successfully, but these errors were encountered: