Elasticsearch 7.10 实时刷新设置指南:如何启用实时索引
在 Elasticsearch 7.10 中,可以通过在索引模板中设置'realtime' 参数为'true' 来启用实时刷新。实时刷新意味着当索引文档时,文档将立即对搜索可见,而不需要等待刷新间隔。
以下是一个示例的索引模板配置:
PUT _index_template/my_template
{
"index_patterns": ["my_index*"],
"template": {
"settings": {
"index": {
"refresh_interval": "1s",
"number_of_shards": 1,
"number_of_replicas": 1
}
},
"mappings": {
"properties": {
"message": {
"type": "text"
}
}
}
},
"priority": 100,
"composed_of": []
}
在上述示例中,'refresh_interval' 设置为'1s',这意味着每秒将进行一次刷新。此外,我们没有显式设置'realtime' 参数,因为在 ES 7.10 中,默认值为'true'。
请注意,在高负载环境中启用实时刷新可能会对性能产生一定的影响。因此,您应该根据您的特定用例和硬件配置来评估是否需要启用实时刷新。
AI 优化版
原文地址:https://www.cveoy.top/t/topic/qugh 著作权归作者所有。请勿转载和采集!