javascript 使用node.js客户端更改ElasticSearch索引的total_fields限制

gopyfrb3  于 2023-02-07  发布在  Java
关注(0)|答案(1)|浏览(120)

我正在使用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限制?

7vhp5slm

7vhp5slm1#

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

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

这里是另一个例子,我是如何使用它与ElasticSearch客户端:

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

相关问题