我想增加模板设置中用于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/