elasticsearch-py icon indicating copy to clipboard operation
elasticsearch-py copied to clipboard

ES Cloud id does not work when using GCP Private Service Connect traffic filters

Open evanvolgas opened this issue 6 months ago • 1 comments

ES Cloud id does not work when using GCP Private Service Connect traffic filters

I think https://github.com/elastic/elastic-transport-python/blob/main/elastic_transport/client_utils.py#L127 is the culprit but I'm not certain. We were able to make things work with the Elastic transport client

# Combine the API key ID and secret, then base64-encode
api_key_credentials = f"{API_KEY_ID}:{API_KEY_SECRET}"
encoded_credentials = base64.b64encode(api_key_credentials.encode()).decode()
auth_header = f"{encoded_credentials}"

# Create a NodeConfig instance
node = NodeConfig(
    scheme="https",
    host="<<my_host>>"
    port=<<my_port>>,
    headers={
        "Authorization": f"Basic {auth_header}"
    }
)

# Initialize the Transport with the NodeConfig and headers
transport = Transport(
    node_configs=[node]
)

# Initialize the Transport with the NodeConfig and headers
transport = Transport(
    node_configs=[node]
)

# Example of performing a request
response = transport.perform_request("GET", "/")

We're still working on connecting the ES Client directly, and it's giving us all kinds of hell

evanvolgas avatar May 13 '25 15:05 evanvolgas