Search code examples
elasticsearchelastic-cloud

Elasticsearch Cloud Id vs Uri using privateLink connection


we have a security requirement to use private link when connecting to Elastic cluster in elastic cloud.

However when using private link our old solution using Cloud Id connection won't work anymore. We tested it and it is confirmed in this discussion - link

We could switch to using Uri connection however I noticed this sentence in the official docs - link

We recommend using a Cloud ID whenever possible because your client will be automatically configured for optimal use with Elastic Cloud, including HTTPS and HTTP compression.

This would be the connection setting we would be using

ConnectionSettings settings =
    new ConnectionSettings(new Uri("https://someUri.privatelink.westeurope.azure.elastic-cloud.com:443"))
        .DefaultIndex(DefaultIndex)
        .EnableDebugMode()
        .MaximumRetries(MaxRetries)
        .MaxRetryTimeout(MaxRetryTimeout)
        .ApiKeyAuthentication(new ApiKeyAuthenticationCredentials("someApiKey"))
        .EnableApiVersioningHeader();

Now I'm not sure what the authors in the official docs meant by optimal use with Elastic cloud.

Are there any settings you can think of we should add here for production ready scenarios ? Are there some things that might not work if we go with out the use of Cloud Id ?


Solution

  • It is not possible to use cloud-id authentication through private link connection. Cloud Id is parsed to the elastic cluster public URL... See this discussion in Elastic discussion board.