danieljames
danieljames

Reputation: 875

Increase field limit on elastic with C# NEST

I'm getting an error with a bulk upload in elastic on C# - saying the field limit of 1000 is exceeded.

Limit of total fields [1000] in index

How can I increase the field limit with NEST in C#?

Upvotes: 1

Views: 1984

Answers (3)

Glorfindel
Glorfindel

Reputation: 22651

Here is a version of @MaurizioChionetti's answer for ElasticSearch 7:

client.LowLevel.Indices.UpdateSettings<StringResponse>(
    indexNameResolver.Resolve(typeof(Product)),
    PostData.Serializable(new {
        index = new { mapping = new { total_fields = new { limit = 100000 } } }
    })
);

(here client is an IElasticClient)

Upvotes: 0

Maurizio Chionetti
Maurizio Chionetti

Reputation: 11

With the version 6.4 of ElasticSearch.net I do it in this way

var settings =  new { index = new { mapping = new  { total_fields = new { limit = 100000 } } } };

            List<object> listOfSettings = new List<object>() { settings };

var setResp = _es.IndicesPutSettings<StringResponse>({Your Index name here}, PostData.MultiJson(listOfSettings));

Upvotes: 1

avr
avr

Reputation: 4883

You can update it by changing that index specific settings as shown below:

curl -XPUT '{elasticsearch_url}:9200/{index-name}/_settings' -d '
{
    "index.mapping.total_fields.limit": 3000
}'

Replace the above placeholders with your cluster information.

Upvotes: 0

Related Questions