結論: 沒有什麼不能夠.
1.若是數據字段不在mapping裏,則動態會更新mapping.
2.數據字段數也能夠小於mapping裏字段數app
DELETE /lib2 PUT /lib2 { "settings": { "number_of_shards": 2, "number_of_replicas": 1 }, "mappings": { "user": { "properties":{ "name":{"type":"keyword"}, "age":{"type":"integer"}, "address":{"type":"text"}, "birth":{"type":"date"} } } } } GET /lib2/_mapping
PUT /lib2/user/1 { "name":"maotai1", "age":21, "address":"shan xi xian", "birth":"2018-02-06T06:22:59.00Z" }
PUT /lib2/user/2 { "name":"maotai2", "age":22 }
PUT /lib2/user/3 { "name":"maotai3", "age":23, "address":"shan xi xian", "birth":"2018-02-06T06:22:59.00Z", "favor":["book","sleep"] }
GET /lib2/user/_search { "query": { "match_all": {} } }
mapping字段數 == 數據字段數
code
mapping字段數 >= 數據字段數
blog
mapping字段數 <= 數據字段數
date