OpenAI connect with elastic search datasource

I am trying call openAI with my custom index created on Elastic search but when I try to run it I am getting following error:

openai.BadRequestError: Error code: 400 - {'error': {'requestid': 'aaa-bbb-404d-8a12-3da23608f42c', 'code': 400, 'message': 'Validation error at #/dataSources/0/Elasticsearch/parameters: Value error, Invalid credentials configuration.  Please use either key and keyId together, or just apiKey.'}}

I am using gpt-4 model, but every time I am getting Please use either key and keyId together, or just apiKey.
The code I have used for this:


client.chat.completions.create(
        messages=message_text,
        model=deployment_id,
        extra_body={
            "dataSources": [
                {
                    "type": "Elasticsearch",
                    "parameters": {
                        "apiKey": "my_apiKey",
                        "endpoint": "my_endpoint",
                        "indexName": "my_indexName",
                    },
                }
            ]
        }
    )