With dynamic template mapping I try to set store: true to be able to disable _source field but doesn't seem to help.
My one template:
{
"template": "mytype*",
"settings": {
"number_of_shards": 3
},
"mappings": {
"mytype": {
"_source": { "enabled": false },
"dynamic_templates": [
{
"default": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"type": "string",
"index": "not_analyzed",
"doc_values": true,
"store": true
}
}
}
]
}
}
}
Output of search http://localhost:9200/mytype-2015.11.18/_mapping?pretty
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 3,
"successful" : 3,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "mytype-2015.11.18",
"_type" : "mytype",
"_id" : "AVEaHFEMPCABS4o_WJOa",
"_score" : 1.0
} ]
}
}