doc_values和fielddata.doc_values映射设置之间有什么区别?

时间:2016-08-31 15:38:38

标签: elasticsearch

问题是关于Elasticsearch 1.x

设置"doc_values": true的文档says应该足以使用基于磁盘的fielddata。像这样:

"string_field": { "doc_values": true, "type": "string", "index": "not_analyzed" }

但是,也可以将doc_values设置为fielddata格式:

"string_field": { "type": "string", "index": "not_analyzed", "fielddata": { "format": "doc_values" } }

所以我的问题是:

这两种方法基本上是一回事吗?

如果没有,有什么区别,他们应该同时使用(我检查过,他们可以,但我不知道是否有任何实际好处)?

1 个答案:

答案 0 :(得分:1)

"fields don't need to be indexed to enable doc values" means you can have "index": "no", for example:

"my_field": {
  "type": "string",
  "index": "no",
  "fielddata": {
    "format": "doc_values"
  }
}

If you want to change format to doc_values, you need to update mapping and reindex your data.