esorm icon indicating copy to clipboard operation
esorm copied to clipboard

Hosts should be optional in connect function

Open heindrickdumdum0217 opened this issue 1 year ago • 0 comments

https://github.com/wallneradam/esorm/blob/main/esorm/esorm.py#L37

hosts parameter should be optional in the connect function. In the underlying library (elasticsearch-py), we can connect using cloud_id and api_key.

If I pass empty hosts, it throws the following error.

from esorm import connect


async def init_es():
    await connect(
        hosts=[],
        cloud_id="cloud_id",
        api_key="api_key"
    )
ValueError: The 'cloud_id' and 'hosts' parameters are mutually exclusive

If I pass None to hosts parameter it works, but Pycharm shows typing warning and fail in mypy.

The following screenshot is from the elasticsearch-py documentation. image

heindrickdumdum0217 avatar Aug 08 '24 03:08 heindrickdumdum0217