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%以內。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM