gpt4 book ai didi

elasticsearch - 压缩到 Elasticsearch 索引

转载 作者:行者123 更新时间:2023-11-29 02:48:21 25 4
gpt4 key购买 nike

有没有办法在 Elasticsearch 中使用新创建的索引将默认压缩方法设置为 best_compression?

显然可以在创建索引后手动完成。

根据谷歌搜索,这应该可以通过在 elasticsearch.yml 中设置它或通过创建自定义模板来设置它来实现。但是,我一直无法在 elasticsearch.yml 中得到它。我尝试了各种变体,但基本上应该这样做:

index.codec: best_compression

但事实并非如此。

我也不喜欢创建自定义模板,因为我的目标是对所有索引进行压缩,而不仅仅是使用某些特定模板创建的索引。但如果这是唯一的方法,那就这样吧。

我的用例是带有 Logstash 的 Elasticsearch,因此 Logstash 是这些索引的创建者。如果没有自定义模板,在 Logstash 配置中设置压缩方法似乎是完全不可能的。我正在运行 Elasticsearch 2.2.0 版。

目前我可以在关闭索引并执行后手动设置压缩:

curl -XPUT 'http://localhost:9200/example_index/_settings' -d '{"index":{"codec":"best_compression"}}'

然后重新打开索引。

来自官方文档:

index.codec

The default value compresses stored data with LZ4 compression, but this can be set to best_compression which uses DEFLATE for a higher compression ratio, at the expense of slower stored fields performance.

来源:https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html

最佳答案

index.codec 设置是节点级别的设置,它不会出现在新索引的设置列表中。如果索引模板专门设置编解码器,那么将使用那个,否则将使用节点级别的那个。

此外,当更改索引的编解码器时,只有新段(在新索引、对现有文档的更改或段合并后)将使用新的编解码器。

关于elasticsearch - 压缩到 Elasticsearch 索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38343499/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com