ES_显式写mapping
PUT nba { "settings":{ "number_of_shards": 1, "number_of_replicas": 0 }, "mappings":{ "properties":{ "name_cn":{ "type":"text" }, "name_en":{ "type":"text" }, "gymnasium":{ "type":"text" }, "topStar":{ "type":"text" }, "championship":{ "type":"integer" }, "date":{ "type":"date", "format":"yyyy-MM-dd HH:mm:ss|| yyy-MM-dd||epoch_millis" } } } }
添加数据,注意一定要有那个_doc 版本是7.1.1
POST /nba/_doc/1 { "name_en":"San Antonio Spurs SAS", "name_cn":"圣安东尼安马刺", "gymnasium":"AT&T中心球馆", "championship": 5, "topStar":"蒂姆·邓肯", "date":"1995-04-12" }