【问题标题】:Increase field limit on elastic with C# NEST使用 C# NEST 增加弹性的字段限制
【发布时间】:2017-09-28 11:09:09
【问题描述】:

我在 C# 上以弹性方式批量上传时遇到错误 - 说超出了 1000 的字段限制。

Limit of total fields [1000] in index

如何在 C# 中使用 NEST 增加字段限制?

【问题讨论】:

  • 您有超过 1000 个字段的文档??
  • 我有一个包含 > 1000 个项目的列表/数组字段的文档。

标签: elasticsearch nest elasticsearch-plugin


【解决方案1】:

在 ElasticSearch.net 的 6.4 版本中,我是这样做的

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));

【讨论】:

    【解决方案2】:

    您可以通过更改索引特定设置来更新它,如下所示:

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

    用您的集群信息替换上述占位符。

    【讨论】:

    【解决方案3】:

    这是 ElasticSearch 7 的 @MaurizioChionetti's answer 版本:

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

    (这里clientIElasticClient

    【讨论】:

      猜你喜欢
      • 2012-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多