Search code examples
elasticsearchnestelasticsearch-7

Elasticsearch: Limit of total fields setting when creating index


I am struggling with a new problem in ElasticSearch 7. I get the "limit of total fields" error when trying to create the index with auto map in Nest library, c#.

 await _elasticContext.GetClient().Indices.CreateAsync(indexName, c => c
                .Map<DocumentWrapper>(m => m.AutoMap()));

Question is how to integrate the index.mapping.total_fields.limit into the query above? Or an alternative solution, if there is one?

Thank you


Solution

  • Please find an example below

    var response = await client.Indices.CreateAsync("my_index1", c => c
        .Settings(s => s.Setting("index.mapping.total_fields.limit", 10))
        .Map(m => m.AutoMap<Document>()));
    

    Hope that helps.