Create indexedit

The create index API allows to instantiate an index. Elasticsearch provides support for multiple indices, including executing operations across several indices. Each index created can have specific settings associated with it.

When adding settings strip the index. prefix. This applies to settings found in the Index Module documentation.

Simple exampleedit

var settings = new IndexSettings();
settings.NumberOfReplicas = 1;
settings.NumberOfShards = 5;
settings.Settings.Add("search.slowlog.threshold.fetch.warn", "1s");

client.CreateIndex(c => c

Create index with settings and mappings in one go fluentlyedit

client.CreateIndex("myindexname", c => c
        .Add("search.slowlog.threshold.fetch.warn", "1s")
    .AddMapping<ElasticSearchProject>(m => m.MapFromAttributes())
    .AddMapping<Person>(m => m.MapFromAttributes())