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
Aggregationson the bucket and single-bucket aggregate types, such asCommonAggregationsDateHistogramBucket,CommonAggregationsStringTermsBucket,CommonAggregationsMultiBucketBaseandCommonAggregationsSingleBucketAggregateBase(theAsFilterresult). It holds the sub-aggregations a response nests in each bucket, keyed by name, and each value decodes through itsAs<Type>()accessor. Withtyped_keysthe key is prefixedtype#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,LookupShardorLookupDocShard. A client that only searches wildcard patterns such aslogs-*no longer sends these requests. By @ryanyuan in #1395 - fix(opensearchutil):
BulkIndexerrequests got smaller whileAddwaited for memory underMaxMemoryBytesand 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):
BulkIndexersealed 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 withNoShardRouter. 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):
CommonQueryDSLTermsQueryhad no way to name the field atermsquery applies to, and decoding one dropped its field and values. It now has aFieldsmap keyed by field name, written next to_name,boostandvalue_type. A value holds either a list of terms or aCommonQueryDSLTermsLookup. A value the generated types do not describe, such as a lookup byquery, is kept as raw JSON and re-encoded unchanged. Reported by @joshuar in #1364. By @ryanyuan in #1391
Breaking changes
CommonQueryDSLTermsQueryand the bucket and single-bucket aggregate types hold a map, so they are no longer comparable with==. They also gainMarshalJSONandUnmarshalJSONmethods, so a struct of yours that embeds one inherits them and its other fields stop encoding and decoding. Give that struct its ownMarshalJSONandUnmarshalJSON, or hold the generated type in a named field instead of embedding it. Marshaling aFieldsorAggregationsentry whose key names a fixed property, such asboostordoc_count, returns an error. Before/after is inUPGRADING_V5.md. By @ryanyuan in #1391
Dependencies
- Bump
github.com/aws/aws-sdk-go-v2from 1.48.0 to 1.48.2 andaws-sdk-go-v2/configfrom 1.33.18 to 1.33.23 (#1388, #1412) - Bump
github.com/wI2L/jsondifffrom 0.7.1 to 0.7.2 (#1413) - Bump
github.com/klauspost/compressfrom 1.20.3 to 1.20.5 incompress(#1390) - Bump
golang.org/x/toolsfrom 0.52.0 to 0.53.0 incmd/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.