node.js - 在Elasticsearch 6x中何处添加索引缓冲区大小

标签 node.js elasticsearch elasticsearch-5 elasticsearch-6

我想增加模板设置中用于Elasticsearch的缓冲区大小,但应在哪里添加此设置。我应该在哪里写indices.memory.index_buffer_size:?据我了解,应该为索引定义它,实际上我只有一个索引。

const indexTemplateSettings = {
    number_of_shards: 2,
    number_of_replicas : 0,
    refresh_interval: '3600s',
    'indices.memory.index_buffer_size': '30%',
    // 'store.throttle.max_bytes_per_sec' : '100mb',
    max_result_window: 1000000000,
    'index.routing.allocation.enable': 'all',
}

export const init = async types => {
    try {
        let client = createClient()

        const templateSettings = {
            index_patterns : ['*'],
            settings: indexTemplateSettings,
            mappings : types.reduce((p, type) => ({
                ...p,
                [type] : {
                    numeric_detection: true,
                    _source : {enabled : true},
                    dynamic_templates: [
                        {
                            all: {
                                match: '*',
                                mapping: {
                                    copy_to: searchField,
                                },
                            },
                        },
                    ],
                    properties: {
                        _searchField: {
                            type: 'text',
                        },
                    },
                },
            }), {}),
        }

        await client.indices.putTemplate({
            name: 'default',
            body: templateSettings,
        },(error, response) => {
            logger.silly('Pushing of index template completed', response)
        })
    } catch (e) {
        logger.error(e)
    }
}

最佳答案

这应该转到elasticsearch.yml配置文件。引用relevant docs:

The following settings are static and must be configured on every data node in the cluster



默认值为堆的10%。那是一个节点范围的设置,而不是基于每个索引。

附带说明:这应该是512MB per shard as the maximum as described in the docs

关于node.js - 在Elasticsearch 6x中何处添加索引缓冲区大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49813751/

相关文章:

node.js - 虚拟机上的 NodeJS Protractor - 如何修复错误 199?

node.js - AWS环境下如何查看stdout?

amazon-web-services - 为什么 AWS Elasticsearch Minimum free storage space metric 不同于 cat allocation api

kibana - elasticsearch/kibana 错误“数据太大,[@timestamp] 的数据将大于限制

elasticsearch - Elasticsearch检查标题是否已在类型中使用

ElasticSearch 2.4.6 根本没有启动,没有任何错误消息 Ubuntu 16.04

elasticsearch - 无法在ELK 5.4上正确解析timetstamp

javascript - 如何知道 npm 包是否可以使用 ES6 导入语法导入?

windows - Meteor 作为 native OSX 或 Windows 8 应用程序

php - ElasticSearch索引的“建议”映射不会返回结果