我试图使用以下语法创建索引
curl -H "Content-Type: application/json" -XPUT 127.0.0.1:9200/movies -d '
{
"mappings": {
"movie": {
"properties": {
"year": {"type":"date"}
}
}
}
}'我想“电影”不可能是“映射”的子级,有人能帮我把这个转换成Elasticsearch 7兼容的语法吗?
我试过使用"movie.year" : {"type":"date"},但是接下来的insert语句失败了
curl -H "Content-Type: application/json" -XPUT 127.0.0.1:9200/movies/movie/109487 -d '
{
"genre":["IMAX", "Sci-Fi"],
"title":"Intersteller",
"year":2014
}'我抄录自Elasticsearch 6教程
拒绝电影的映射更新,因为最终映射将有一个以上的类型:_doc,电影
发布于 2019-08-21 06:07:03
在ES 7中,有不再有类型。你得这样做。
首先,创建索引
curl -H "Content-Type: application/json" -XPUT 127.0.0.1:9200/movies -d '
{
"mappings": {
"properties": {
"year": {"type":"date"}
}
}
}'那么,索引您的文档
curl -H "Content-Type: application/json" -XPUT 127.0.0.1:9200/movies/_doc/109487 -d '
{
"genre":["IMAX", "Sci-Fi"],
"title":"Intersteller",
"year":2014
}'https://stackoverflow.com/questions/57585321
复制相似问题