[DOCS] Connect via endpoint URL (fix Cloud ID mismatch) - #8901
Conversation
✅ Vale Linting ResultsNo issues found on modified lines! The Vale linter checks documentation changes against the Elastic Docs style guide. To use Vale locally or report issues, refer to Elastic style guide for Vale. |
🔍 Preview links for changed docs |
|
|
||
| ### Using a Cloud ID (Elastic Cloud hosted only) [cloud-id] | ||
|
|
||
| On hosted Elastic Cloud deployments you can alternatively pass the **Cloud ID** string from the deployment overview together with credentials. The client resolves the Cloud ID to cluster nodes and applies defaults suited to Elastic Cloud (including HTTPS and HTTP compression). |
There was a problem hiding this comment.
to cluster nodes should be to the deployment URL as all nodes are hidden behind Elastic Cloud's proxy.
We can also remove HTTP since it's HTTPS only. I would actually remove the entire (including ... compression) snippet as the goal of defaults is to simplify the user's life and not have them care about it!
There was a problem hiding this comment.
The client resolves the Cloud ID to cluster nodes and applies defaults suited to Elastic Cloud (including HTTPS and HTTP compression)
This is actually not true 😅 These optimizations only get applied when using the Cloud ID (CloudNodePool in the client).
The above ElasticsearchClientSettings constructor overload using an url will resolve to the SingleNodePool - which does not apply any cloud specific parameters.
The urls are not a reliable inidicator (since custom domains are often used) and therefore not used to change the behavior. The .NET client requires the user to express explicit intent:
var pool = new CloudNodePool(new Uri("<ELASTICSEARCH_ENDPOINT>"), new ApiKey("<API_KEY>"));
var settings = new ElasticsearchClientSettings(pool);There was a problem hiding this comment.
The node sniffing implementations live in Elastic.Transport (elastic/elastic-transport-net) and I'm afraid this is only documented in code, since we still did not release a documentation for the transport library (which technicall is still in alpha (0.x version)).
The user has to express explicit intent here as well by using either SniffingNodePool or StickySniffingNodePool.
┌───────────────────────────────────────────┬─────┬───────────────────────────────────────────────────────────┬────────────┬───────────────────────────────────────────┐
│ Pool │ Pin │ Sniff (reseed) │ MaxRetries │ Selection │
│ │ gs │ │ │ │
├───────────────────────────────────────────┼─────┼───────────────────────────────────────────────────────────┼────────────┼───────────────────────────────────────────┤
│ SingleNodePool │ off │ off (Reseed no-op) │ 0 │ the single node │
│ CloudNodePool (extends SingleNodePool) │ off │ off (Reseed no-op) │ 0 │ the cloud endpoint │
│ StaticNodePool │ on │ off (Reseed no-op) │ nodes.Coun │ round-robin via global cursor (with │
│ │ │ │ t │ dead/alive tracking) │
│ │ │ │ - 1 │ │
│ SniffingNodePool (extends StaticNodePool) │ on │ on (writes new node list under a ReaderWriterLockSlim) │ nodes.Coun │ round-robin via global cursor over the │
│ │ │ │ t │ sniffed list │
│ │ │ │ - 1 │ │
│ StickyNodePool (extends StaticNodePool, │ on │ off (Reseed overridden as no-op) │ nodes.Coun │ always starts at cursor 0, sticks to the │
│ sealed) │ │ │ t │ first alive node │
│ │ │ │ - 1 │ │
│ StickySniffingNodePool (extends │ on │ on (with optional Func<Node, float> nodeScorer; default │ nodes.Coun │ always starts at cursor 0, sticks to the │
│ SniffingNodePool, sealed) │ │ scorer returns 0f) │ t │ first alive node │
│ │ │ │ - 1 │ │
└───────────────────────────────────────────┴─────┴───────────────────────────────────────────────────────────┴────────────┴───────────────────────────────────────────┘
|
@charlotte-hoblik Hey 👋 are you going to iterate on this? Feel free to contact me, if anything needs clarification. |
|
Thanks @swallez and @flobernd for the review and sorry for the slow follow-up on my side. @flobernd especially: I really appreciate how much time you put into this. The pool behavior explanation and the sniffing context were a huge help. That kind of research makes the docs and the author better. Thank you. I’ve updated
If you’d rather keep CloudNodePool called out explicitly for advanced readers, I’m happy to add a single sentence. Thanks again—please take another look when you can. |
Co-authored-by: Florian Bernd <git@flobernd.de>
Same direction as elastic/docs-content#5414: prefer the Elasticsearch endpoint URL in connection examples so steps match the Cloud UI, curl, and other client docs.
This addresses elastic/docs-content#2431 :
CLOUD_ID.