云搜索服务提供了写入自适应优化功能,在非主键更新写入场景(例如日志写入)下开启写入自适应优化后,bulk 写入过程中会自动选择性能更好的分片,实现写入性能的提升。
您可以通过指定配置项 index.shard_routing.enabled
和 indices.bulk.adaptive_shard_selection.enabled
来开启写入自适应优化功能,开启后可以将批量写请求自动路由到性能更好的分片上,从而提升整体写入性能。其中:
index.shard_routing.enabled
:是否开启 bulk 定向路由,默认值为 false
,表示使用默认路由规则,即默认采用 _id
作为单个文档的写入 routing。设置为 true
时,表示开启 bulk 定向路由,可以避免写入长尾效应。更多信息,请参见 Bulk 定向路由。indices.bulk.adaptive_shard_selection.enabled
:是否开启自适应写入优化,默认值 false
,表示不开启。设置为 true
时,表示开启自适应写入优化,bulk 写入过程中会自动选择性能更好的分片。7.10.2
版本实例。2.9.0
版本实例。index.shard_routing.enabled
和集群参数 indices.bulk.adaptive_shard_selection.enabled
时,写入自适应优化功能才会生效。_id
获取文档信息。deletebyquery
和 updatebyquery
功能。PUT _cluster/settings { "persistent": { "indices.bulk.adaptive_shard_selection.enabled":"true" } }