我想在模板设置中增加 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)
}
}