Elasticsearch中doc_value的認識


前言:本文的目的是為后續磁盤空間利用優化做鋪墊。主要知識點來源於官網文檔

一、doc_value是什么

  1. 絕大多數的fields在默認情況下是indexed,因此字段數據是可被搜索的。倒排索引中按照一定順序存放着terms供搜索,當命中搜索時,返回包含term的document。

    terms 中包含很多term

  2. 當Sorting、aggregations、scripts access to field這三種情況的時候,我們需要另外的data access模式。這種模式和上述在terms中尋找term並且返回document是不同的

  3. Doc values 為on-disk 數據結構,在document索引時被創建。Doc values 存放的values和 _source這個meta-Fields是一致的。支持除了analyzed string 以外的所有類型。

二、doc_value特性

  1. doc_value 默認情況下是enable的。
  2. column-oriented 存放field,以便sort、aggregate、access the field from a script
  3. disable doc_value:
PUT my_index
{
  "mappings": {
    "my_type": {
      "properties": {
        "mystring": { 
          "type":       "keyword",
          "doc_values": false
        }
      }
    }
  }
}

三、disable doc_value會怎樣

  • 消極影響:sort、aggregate、access the field from script將會無法使用
  • 積極影響:節省磁盤空間


免責聲明!

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



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