github opensearch-project/opensearch-go v5.2.2

56 minutes ago

opensearch-go v5.2.2

v5.2.2 stops discovery from fetching routing metadata, on every cycle, for indexes the client never uses. A client that only searches wildcard patterns such as logs-* used to request metadata for every index in the cluster and throw the results away.

It also fixes two cases where BulkIndexer sent smaller bulk requests than it should while Add waited for memory, lets a terms query name its field and values, and gives each aggregation bucket its sub-aggregations.

Requires Go 1.26.0 or later.

Full Changelog: v5.2.1...v5.2.2


What's new

  • Aggregations on the bucket and single-bucket aggregate types, such as CommonAggregationsDateHistogramBucket, CommonAggregationsStringTermsBucket, CommonAggregationsMultiBucketBase and CommonAggregationsSingleBucketAggregateBase (the AsFilter result). It holds the sub-aggregations a response nests in each bucket, keyed by name, and each value decodes through its As<Type>() accessor. With typed_keys the key is prefixed type#name. Requested by @joshuar in #1367. By @ryanyuan in #1391

Fixes

  • fix(opensearchtransport): discovery requested routing metadata on every cycle for indexes the client had never used. It now fetches metadata only for indexes the client has sent a request to by name or looked up with ShardMap, LookupShard or LookupDocShard. A client that only searches wildcard patterns such as logs-* no longer sends these requests. By @ryanyuan in #1395
  • fix(opensearchutil): BulkIndexer requests got smaller while Add waited for memory under MaxMemoryBytes and a node had every request out that it allows. When a request was answered, the freed slot went to a newly sealed buffer before the one already queued for the node. The queued buffer now gets the slot first. By @sean- in #1394
  • fix(opensearchutil): BulkIndexer sealed a buffer early to free memory even when the buffer had to wait for an earlier request with the same document ID, as can happen with NoShardRouter. Sealing it freed nothing and sent it later as a smaller request. A buffer is now sealed early only when it can be sent at once. By @sean- in #1394
  • fix(opensearchapi): CommonQueryDSLTermsQuery had no way to name the field a terms query applies to, and decoding one dropped its field and values. It now has a Fields map keyed by field name, written next to _name, boost and value_type. A value holds either a list of terms or a CommonQueryDSLTermsLookup. A value the generated types do not describe, such as a lookup by query, is kept as raw JSON and re-encoded unchanged. Reported by @joshuar in #1364. By @ryanyuan in #1391

Breaking changes

  • CommonQueryDSLTermsQuery and the bucket and single-bucket aggregate types hold a map, so they are no longer comparable with ==. They also gain MarshalJSON and UnmarshalJSON methods, so a struct of yours that embeds one inherits them and its other fields stop encoding and decoding. Give that struct its own MarshalJSON and UnmarshalJSON, or hold the generated type in a named field instead of embedding it. Marshaling a Fields or Aggregations entry whose key names a fixed property, such as boost or doc_count, returns an error. Before/after is in UPGRADING_V5.md. By @ryanyuan in #1391

Dependencies

  • Bump github.com/aws/aws-sdk-go-v2 from 1.48.0 to 1.48.2 and aws-sdk-go-v2/config from 1.33.18 to 1.33.23 (#1388, #1412)
  • Bump github.com/wI2L/jsondiff from 0.7.1 to 0.7.2 (#1413)
  • Bump github.com/klauspost/compress from 1.20.3 to 1.20.5 in compress (#1390)
  • Bump golang.org/x/tools from 0.52.0 to 0.53.0 in cmd/osapilint (#1389)
  • Pin every nested module to the v5.2.2 root module. By @ryanyuan in #1422

See CHANGELOG.md for the full list.

Contributors

Thanks to everyone who contributed to this release: @sean- and @ryanyuan.

Thanks to @joshuar for reporting the missing field on the terms query and asking for access to nested aggregations.

Don't miss a new opensearch-go release

NewReleases is sending notifications on new releases.