How to run elasticsearch for local development after upgrading from 7.17 to 8.17

I am currently upgrading my codebase from elasticsearch 7.17 to 8.17. I am using the elasticsearch python client. For 7.17 we used this code to create an elasticsearch instance:

ES = elasticsearch.Elasticsearch(
    ('%s:%s' % (feconf.ES_HOST, feconf.ES_LOCALHOST_PORT))
    if feconf.ES_CLOUD_ID is None else None,
    cloud_id=feconf.ES_CLOUD_ID,
    http_auth=(
        (feconf.ES_USERNAME, secrets_services.get_secret('ES_PASSWORD'))
        if feconf.ES_CLOUD_ID else None), timeout=30)

wherein, if the ES_CLOUD_ID is present, it means the we are in prod and if absent, we connect to the local instance without using any authentication.

While upgrading to 8.17, I am using this code:

ES = elasticsearch.Elasticsearch(
    hosts=(
        [f'https://{feconf.ES_HOST}:{feconf.ES_LOCALHOST_PORT}']
        if feconf.ES_CLOUD_ID is None else None
    ),
    cloud_id=feconf.ES_CLOUD_ID,
    basic_auth=(
        (feconf.ES_USERNAME, secrets_services.get_secret('ES_PASSWORD'))
        if feconf.ES_CLOUD_ID else None
    ),
    timeout=30,
    verify_certs=False,
)

While this is allowing me to connect, since authentication is mandatory from es 8.x onwards, I get this error:

elasticsearch.AuthenticationException: AuthenticationException(401, 'security_exception', 'missing authentication credentials for REST request [/explorations/_doc/7DZhIrir215y]')

Is there a standard way to run Elasticsearch for local development?

(I have considered setting 'xpack.security.enabled' to False but I am not sure how to do that on the github CI and would like to find a more elegant solution if possible)