Updated on 2024-11-29 GMT+08:00

Disabling Doc Values

By default, all fields that support doc values are enabled. Because doc values are enabled by default, you can aggregate and sort most fields in a dataset. However, if it is determined that you do not need to sort and aggregate fields, or access a field value from a script, you can disable doc values to save disk space.

To disable doc values, set doc_values to false in the field mapping. For example, a new index is created, and doc values are disabled for the session_id field.

curl -XPUT --tlsv1.2 --negotiate -k -u : "http://ip:httpport/myindex" -H 'Content-Type: application/json' -d'
{
"mappings": {
      "my_type": {
           "properties": {
                 "session_id": {
                         "type": "keyword",
                         "doc_values": false
                  }
            }
       }
    }
}'