gpt4 book ai didi

elasticsearch - 使用NEST设置Elasticsearch routing_partition_size

转载 作者:行者123 更新时间:2023-12-03 01:27:22 29 4
gpt4 key购买 nike

我正在使用NEST在Elasticsearch 5.5中创建索引。我需要在创建索引时更新index.routing_partition_size设置,但在CreateIndexDescriptor对象中看不到该设置。如何在NEST中指定此值?

我的设置当前如下所示:

return createIndexSelector
//add analyzers and tokenizers
.Settings(s => s
.NumberOfReplicas(2)
.NumberOfShards(40)
.Setting("refresh_interval", 10)
.Analysis(a => a
.Analyzers(az => az
.Custom("str_search_analyzer", c1 => GetCustomSearchAnalyzer())
.Custom("str_index_analyzer", c2 => GetCustomNgramAnalyzer()))
.Tokenizers(tz => tz
.NGram("autocomplete_ngram_tokenizer", ng => GetCustomAutoCompleteTokenizer()))))
//add mappings for invoice and contact doc types
.Mappings(m => m
.Map<DocType>(mDocType => mDocType .Properties(DocType.AddAllMappings)));

最佳答案

假设您正在使用NEST 5.x,它位于IndexSettingsDescriptor

var createIndexResponse = await client.CreateIndexAsync("index", c => c
.Settings(s => s.RoutingPartitionSize(10)));

产生以下请求
{
"settings": {
"index.routing_partition_size": 10
}
}

希望能有所帮助。

关于elasticsearch - 使用NEST设置Elasticsearch routing_partition_size,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57713251/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com