Setting up a nested field is simple—where you would normally specify type object, make it type nested instead:
创建一个nested 字段很简单——只要在你通常指定object类型的地方,改成nested类型就行:
curl -XPUT 'localhost:9200/my_index' -d ' { "mappings":{ "blogpost":{ "properties":{ "comments":{ "type":"nested", "properties":{ "name": {"type":"string" }, "comment": { "type": "string" }, "age": { "type": "short" }, "stars": { "type": "short" }, "date": { "type": "date" } } } } } } }
原文:http://www.elastic.co/guide/en/elasticsearch/guide/master/nested-mapping.html
时间: 2024-10-11 07:15:13