Elasticsearch中doc_value的认识

1081775-20170111175824025-490303763.png

前言:本文的目的是为后续磁盘空间利用优化做铺垫。主要知识点来源于官网文档

一、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将会无法使用
  • 积极影响:节省磁盘空间

转载于:https://www.cnblogs.com/yangwenbo214/p/6274644.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值