如果我把这样的文件:
$ curl -XPOST "http://localhost:9200/test/test/" -d '
{
"books": {
"id1": {
"name": "Hello World!"
},
"id2": {
"name": "Hitchhiker Guide To The Galaxy"
}
}
}'
然后它创建一个像这样的映射:
$ curl -XGET "http://localhost:9200/test/test/_mapping"
{
"test":{
"mappings":{
"test":{
"properties":{
"books":{
"properties":{
"id1":{
"properties":{
"name":{
"type":"string"
}
}
},
"id2":{
"properties":{
"name":{
"type":"string"
}
}
}
}
}
}
}
}
}
}
“books”对象中的属性/键是动态的,映射会无限增长。如何让 ES 不查看“books”的键并使其了解“books”中的每个值都属于同一类型?例如,映射不应该包含每个图书 ID 的新条目。