gpt4 book ai didi

Elasticsearch _时间戳

转载 作者:行者123 更新时间:2023-11-29 02:46:22 24 4
gpt4 key购买 nike

我试图在索引上定义 _timestamp 属性。所以首先,我创建索引

curl -XPUT 'http://elasticsearch:9200/ppe/'

来自服务器的响应:{"ok":true,"acknowledged":true}

然后我尝试用 _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"
}
}
}
}'

我从服务器收到了回复

{
"error": "MapperParsingException[No type specified for property [_timestamp]]",
"status": 400
}

我的映射有什么问题?

最佳答案

_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"
}
}
}
}
'

关于 Elasticsearch _时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13744233/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com