opensearch-go v5.0.3
UPGRADE NOTE - v5.0.3 turns on periodic node discovery by default.
DiscoverNodesIntervaldefaults to 30s when a router is in use, and that includes the default router. Under the old0default the discovery loop never ran. The client missed nodes added after startup, and a node flagged after a failed request stayed out of shard-aware routing until restart, because only that loop refreshes/_cat/shards.- To keep periodic discovery off, set
DiscoverNodesIntervalto a negative value. Without a router,0still turns it off.Before/after is in
UPGRADING_V5.md.
v5.0.3 adds an optional compress module with klauspost codecs and a typed builder for _msearch bodies. It also fixes snapshot responses that failed to decode, fills in the aggregation fields the generator was dropping, and extends the osapilint v4 -> v5 migration.
Requires Go 1.26.0 or later.
Full Changelog: v5.0.2...v5.0.3
What's new
- The new
compressmodule (github.com/opensearch-project/opensearch-go/compress/v5) providesGzip,DeflateandSnappy. Each returns anopensearchtransport.Compressorbacked bygithub.com/klauspost/compress. It ships as a separate module so klauspost stays out of the client's dependency graph, and no klauspost type appears in its API.GzipandDeflatereject an invalid level at construction, andcompress.DefaultLevelpicks the codec's own default (#1199) opensearchapi.BuildMSearchBodybuilds the newline-delimited body forMSearchReq.Bodyfrom typedSearchBodyvalues, so you no longer hand-encode a header line and a body line per search. A sub-search with noIndicesruns against the indices on theMSearchReq, and a nilBodybecomes an empty search (#1214)
Fixes
- fix(opensearchapi):
client.Snapshot.Getandclient.Snapshot.Createfailed withfailed to json unmarshal bodyon an HTTP 200 whenever a snapshot carried a shard failure. The server writesshard_idas an integer while the spec declares a string.SnapshotShardFailure.ShardIDstays a*stringand now accepts an integer, stored as its decimal string (opensearch-api-specification#1263). By @xluo-aws in #1198 - fix(osgen):
CommonAggregationsAggregationContainernow has its aggregation fields. When anallOfmember is aoneOforanyOf, the generator merges every branch's properties as optional fields. Reported in #1190. By @MohammedAlkindi in #1197 - fix(osapilint): the v4 -> v5 hop migrates the
IndexTemplate,ComponentTemplate,Template,ScriptandDataStreamsub-clients and reportsplugins/securityandplugins/ismcode, which it used to skip with exit 0. It also completes on v4 code that setsPretty,H,Vor the timeout params, where it used to abort with anosapilint bugerror. Reported by @Jakob3xD in #1174. By @ryanyuan in #1213 - docs: godoc and guide defaults now match the code.
MaxRetriesis 6, not 3.HealthCheckTimeoutis 5s, not 3s.HealthCheckMaxRetriesis 6, not 3.HealthCheckJitteris 0.1, not 0.2 (#1211)
Dependencies
- Bump
github.com/aws/aws-sdk-go-v2to 1.47.3 andaws-sdk-go-v2/configto 1.33.9 (#1206, #1207) - Bump
golang.org/x/syncto 0.24.0,golang.org/x/modto 0.42.0 and, incmd/osapilint,golang.org/x/tools(#1200, #1208, #1209, #1210)
See CHANGELOG.md for the full list.
Contributors
Thanks to everyone who contributed to this release: @ryanyuan, @sean-, @MohammedAlkindi, and @xluo-aws.