Xav*_*ier 8 elasticsearch elasticsearch-mapping
我试图_timestamp在索引上定义属性.首先,我创建索引
curl -XPUT 'http://elasticsearch:9200/ppe/'
来自服务器的响应: {"ok":true,"acknowledged":true}
然后我尝试用a定义映射 _timestamp
curl -Xput 'http://elasticsearch:9200/ppe/log/_mapping' -d '{
"log": {
"properties": {
"_ttl": {
"enabled": true
},
"_timestamp": {
"enabled": true,
"store": "yes"
},
"message": {
"type": "string",
"store": "yes"
},
"appid": {
"type": "string",
"store": "yes"
},
"level": {
"type": "integer",
"store": "yes"
},
"logdate": {
"type": "date",
"format": "date_time_no_millis",
"store": "yes"
}
}
}
}'
Run Code Online (Sandbox Code Playgroud)
我收到服务器的答复
{
"error": "MapperParsingException[No type specified for property [_timestamp]]",
"status": 400
}
Run Code Online (Sandbox Code Playgroud)
我的映射有什么问题?
imo*_*tov 16
特殊字段,例如_ttl,_timestamp必须在与properties对象相同的级别上定义:
curl -Xput 'http://elasticsearch:9200/ppe/log/_mapping' -d '{
"log": {
"_ttl": {
"enabled": true
},
"_timestamp": {
"enabled": true,
"store": "yes"
},
"properties": {
"message": {
"type": "string",
"store": "yes"
},
"appid": {
"type": "string",
"store": "yes"
},
"level": {
"type": "integer",
"store": "yes"
},
"logdate": {
"type": "date",
"format": "date_time_no_millis",
"store": "yes"
}
}
}
}
'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6346 次 |
| 最近记录: |