我在Elasticsearch中上传索引时遇到问题。
curl -H "Content-Type: application/json" -XPUT http://localhost:9200/technogym_error_timeline -d "{\"mappings\":{\"timestamp\":{\"type\":\"date\",\"format\":\"yyyy-MM-dd\"}}}"
我收到此错误:
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters: [format : yyyy-MM-dd] [type : date]"}],"type":"mapper_parsing_exception","reason":"Failed to parse mapping [timestamp]: Root mapping definition has unsupported parameters: [format : yyyy-MM-dd] [type : date]","caused_by":{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters: [format : yyyy-MM-dd] [type : date]"}},"status":400}
为什么我的curl命令错误?
感谢。
答案 0 :(得分:1)
您错过了类型声明:
curl -H "Content-Type: application/json" -XPUT http://localhost:9200/technogym_error_timeline -d '{
"mappings":{
"your_type_name": { <--- add this
"properties": { <--- and this
"timestamp":{
"type":"date",
"format":"yyyy-MM-dd"
}
}
}
}
}'