环境
ubuntu16、elasticsearch7.5.1
问题
索引新文档:
#索引:gb,类型:tweet,id:1
curl -H "Content-Type:application/json" -XPUT 'http://localhost:9200/gb/tweet/1' -d '
{
"date":"2019-12-26",
"name":"damon",
"user_id":1001
}'
ES查看其映射:
curl -H "Content-Type:application/json" -XGET 'http://localhost:9200/gb/_mapping/tweet/?pretty'
提示ERROR:
"type" : "illegal_argument_exception",
"reason" : "Types cannot be provided in get mapping requests, unless include_type_name is set to true."
原因
ES7中剔除了映射类型(原因),查看映射时正确执行语句:
curl -H "Content-Type:application/json" -XGET 'http://localhost:9200/gb/_mapping/?pretty'
映射结果