elasticsearch 索引搜索和索引性能优化配置——思路:去掉不必要的数据,减小数据的磁盘空间占用,同时提升性能

压缩配置:
index.codec: best_compression

合并索引:
curl –XPOST localhost:9200/hec_test3/_forcemerge’

配置mapping:
curl -XPUT 'http://localhost:9200/hec_test3' -d '
{
  "mappings": {
    "hec_type3": {
            "_source": {
                "enabled": false
            }, "_all": {
                "enabled": false
            }, "properties": {
                “fieldxxx": {
                    "type": "string",
                    “norms”: {“enabled”: false},
                    “store”: false,
                    "doc_values": false, "index_options": "docs"
                }, ….
            }
        }      
  }
}
'

注意:同时将原始数据放在DB里,ES里通过doc id去DB里获取。_all搜索时候使用cross_fields。.tim文件较大,可以采用降低shard个数来瘦身。

总之,上述设置后可以将es的索引数据磁盘占用降低为原始数据的50%以内。

原文地址:https://www.cnblogs.com/bonelee/p/6934125.html