opensearch-go v4.8.2
CRITICAL UPGRADE RELEASE NOTE - v5 has substantially expanded error handling capabilities compared to v4.
v5.0.0 is out, and v4 is now in maintenance mode. v4.8.2 is a maintenance release: it does not add features. The v4 -> v5 upgrade changes runtime error-handling behavior and is NOT a drop-in replacement across major versions. If you use this client, read this now - even if you are only upgrading to v4.8.2.
v4 only returns transport-level errors; partial failures (e.g. failed bulk items, failed shards, unconfirmed replica writes) are reported inside the response body, not as Go
errorvalues. In v5, those partial failures are returned as errors by default. Code that compiles and passes against v4 can behave differently against v5 without any code change.Upgrading between v4 releases (any
<v4.8.2to anyv4.X.X) does not change the default error-handling semantics. Seeguides/error_handling.mdfor how to adopt the v5 behavior on v4 before you upgrade, and the v4 to v5 migration guide for the full API delta.
v4.8.2 is a patch on top of v4.8.1. It backports the router fix from v5.2.1 that stops tied requests from all going to the same node, and updates the Go toolchain to 1.26.11.
The router fix spreads bulk requests and tied reads across nodes instead of sending them all to one. Previously, the router broke ties between equally scored nodes by URL, so every idle client sent its bulks to the same node, and every read of a shard to the same idle replica. Now a bulk goes to the least loaded of a few randomly drawn nodes, and a tie is broken at random, weighted by shard count for a ?routing= list.
Full Changelog: v4.8.1...v4.8.2
Fixes
- fix(opensearchtransport): the default router sent every request with no index in its path, such as
POST /_bulk, to the same node. The router now draws two random nodes from the nearest RTT tier and one from the farther tiers, and sends the request to the lowest score among them, with each score weighted by the node's write-coordination rate fromindexing_pressure, which the node stats poll now requests.NodeStatsgains anIndexingPressurefield. Reported by @sean- in #1363. By @sean- in #1366, backported in #1369 - fix(opensearchtransport): the router always chose the same node among candidates with the same score, such as two idle replicas of a shard for
GET /{index}/_doc/{id}. It now chooses among them at random. For a?routing=list, each tied node's chance is proportional to how many of the keys' shards it hosts. A candidate with a better score still wins. By @sean- in #1366, backported in #1369
Dependencies
- Update the
toolchainline from go1.26.9 to go1.26.11 in the root module andcmd/osgen, so builds in this repository use Go 1.26.11, which carries security fixes to cgo, the go command, the compiler, the linker andnet/http. The go directive stays 1.26.0, so consumers are not affected; build your own binaries with Go 1.26.11 or newer to get the fixes. By @ryanyuan in #1361
See CHANGELOG.md for the full list.
Contributors
Thanks to everyone who contributed to this release: @sean- and @ryanyuan.