Creating an index Nest

后端 未结 5 1216
傲寒
傲寒 2020-12-19 03:01

How would I recreate the following index using Elasticsearch Nest API?

Here is the json for the index including the mapping:

{
    \"settings\": {
           


        
5条回答
  •  囚心锁ツ
    2020-12-19 03:41

    In case people have NEST 2.0, the .NumberOfReplicas(x).NumberOfShards(y) are in the Settings area now so specify within the lamba expression under Settings.

            EsClient.CreateIndex("indexname", c => c
            .Settings(s => s
                 .NumberOfReplicas(replicasNr)
                 .NumberOfShards(shardsNr)
            )
    

    NEST 2.0 has a lot of changes and moved things around a bit so these answers are a great starting point for sure. You may need to adjust a little for the NEST 2.0 update.

提交回复
热议问题