Elasticsearch将扁平化嵌套对象,因此在内部您将获得:
{ "title":"The Judge","year":2014,"casting.name": ["Robert Downey Jr.","Robert Duvall"],"casting.category": ["Producer", "Actor"]}如果要保留关系,则需要使用嵌套对象或父子关系
要进行嵌套映射,您需要执行以下操作:
"mappings": { "movies": { "properties": { "title" : { "type": "string" }, "year" : { "type": "integer" }, "casting": { "type": "nested","properties": { "name": { "type": "string" }, "category": { "type": "string" } } } } } }


