如何获取字段的doc_values值?

时间:2019-12-11 10:45:19

标签: elasticsearch

如何修改下面的查询以获取字段的doc_values?

弹性2.3

curl http://localhost:9200/_mapping 退货 { "my_index": { "mappings": { "my_type": { "properties": { "my_field": { "type": "string", "index": "not_analyzed" } } } } }

1 个答案:

答案 0 :(得分:0)

curl -X PUT "elasticsearch:9200/my_index?pretty" -H 'Content-Type: application/json' -d' { "mappings": { "my_index": { "properties": { "status_code": { "type": "string", "index": "not_analyzed" }, "session_id": { "type": "string", "index": "not_analyzed", "doc_values": false } } } } }

响应 curl "elasticsearch:9200/my_index/_mapping?pretty" { "my_index" : { "mappings" : { "my_index" : { "properties" : { "session_id" : { "type" : "string", "index" : "not_analyzed", "doc_values" : false }, "status_code" : { "type" : "string", "index" : "not_analyzed" } } } } } }

doc_values默认为true。在这种情况下未显示。但是显示doc_values == false。

参考:https://www.elastic.co/guide/en/elasticsearch/reference/2.3/doc-values.html