【问题标题】:Change total_fields limit for Elasticsearch index using node.js client使用 node.js 客户端更改 Elasticsearch 索引的 total_fields 限制
【发布时间】:2023-02-07 14:24:51
【问题描述】:

我正在使用 node.js Elasticsearch 7.17 客户端创建默认索引设置,我希望 total_fields limit 超过默认的 1000。当我尝试以下操作时:

export const defaultCaseIndexSettings: IndicesIndexSettings = {
  'index.number_of_replicas': 0,
  'index.number_of_shards': 6,
  'index.max_result_window': Number(INDEX_MAX_RESULT_WINDOW),
  'index.mapping.total_fields.limit': 10000,
etc.
}

index.mapping.total_fields.limit好像不是可以在IndicesIndexSettings上设置的设置。我也试过:

export const defaultCaseSettingsIndexConfig: IndicesCreateRequest['body'] = {
  settings: {
    index: {
      number_of_shards: '2',
      number_of_replicas: '2',
      mapping: {
        total_fields: {
          limit: 10000,
        },
      },
    },
  },

这给了我 Object literal may only specify known properties, and 'mapping' does not exist in type 'IndicesIndexSettings'. 如何使用 nodejs Elasticsearch 客户端设置 total_fields 限制?

【问题讨论】:

    标签: javascript node.js elasticsearch indexing


    【解决方案1】:

    我可能会迟到,但这里有一种在创建索引时设置“index.mapping.total_fields.limit”的方法。

    export const defaultCaseSettingsIndexConfig: IndicesCreateRequest["body"] = {
      settings: {
         ...,
        "index.mapping.total_fields.limit": "2000",
      },
    };
    
    

    这是另一个使用 Elasticsearch js 客户端的例子。

    const indexSettings = {
      settings: {
        ...,
        "index.mapping.total_fields.limit": "2000",
      },
    };
    this.client.indices.create({
      index: "my-index",
      body: indexSettings,
      ...
    });
    
    

    【讨论】:

      猜你喜欢
      • 2015-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-01
      • 2021-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多