elasticsearch 使用NEST设置Elasticsearch路由分区大小,elasticsearch,nest,elasticsearch,Nest" /> elasticsearch 使用NEST设置Elasticsearch路由分区大小,elasticsearch,nest,elasticsearch,Nest" />

elasticsearch 使用NEST设置Elasticsearch路由分区大小

elasticsearch 使用NEST设置Elasticsearch路由分区大小,elasticsearch,nest,elasticsearch,Nest,我正在使用NEST在Elasticsearch 5.5中创建索引。我需要在创建索引时更新index.routing\u partition\u size设置,但在CreateIndexDescriptor对象中看不到该设置。如何在嵌套中指定此值 我的设置当前如下所示: return createIndexSelector //add analyzers and tokenizers .Settings(s => s

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

我的设置当前如下所示:

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)));
返回createIndexSelector
//添加分析器和标记器
.Settings(s=>s
.副本数量(2)
.NumberOfShard(40)
.设置(“刷新间隔”,10)
.分析(a=>a
.分析仪(az=>az
.Custom(“str_search_analyzer”,c1=>GetCustomSearchAnalyzer())
.Custom(“str_index_analyzer”,c2=>GetCustomNgramAnalyzer())
.Tokenizers(tz=>tz
.NGram(“autocomplete\u NGram\u tokenizer”,ng=>GetCustomAutoCompleteTokenizer()))
//添加发票和联系人单据类型的映射
.Mappings(m=>m
.Map(mDocType=>mDocType.Properties(DocType.AddAllMappings));

假设您使用的是NEST 5.x,它位于
索引设置描述符下

var createIndexResponse = await client.CreateIndexAsync("index", c => c
    .Settings(s => s.RoutingPartitionSize(10)));
将生成以下请求

{
  "settings": {
    "index.routing_partition_size": 10
  }
}
希望有帮助