Json 动态场的正确映射
我的文件结构如下:Json 动态场的正确映射,json,mapping,
elasticsearch,Json,Mapping,
elasticsearch,我的文件结构如下: { "some_field": "some_data", "entries": { {"id": "some_id", "type": "some_type", "value": "some_value"}, {"id": "another_id", "type": "another_type", "value": {"foo": 1, "bar": "two"} } } 所以我想根据“type”字段映射条目。 我应该使用哪种映射类型或标记? 或
{
"some_field": "some_data",
"entries": {
{"id": "some_id", "type": "some_type", "value": "some_value"},
{"id": "another_id", "type": "another_type", "value": {"foo": 1, "bar": "two"}
}
}
所以我想根据“type”字段映射条目。
我应该使用哪种映射类型或标记?
或者我需要改变我的文档结构?你能用这个吗
{
"some_field":"some_data",
"entries":[{
"id":"some_id",
"type":"some_type",
"value":"some_value"
},
{
"id":"another_id",
"type":"another_type",
"value":{
"foo":1,
"bar":"two"
}
}]
}
在当前结构中,您将使用哪些“类型”字段进行映射?这两个“条目”对象是作为单独的文档编制索引,还是整个对象是单个文档?也许您可以提供实际对象及其关系的描述。这两个条目应该使用“值”字段编制索引。为什么使用列表会有所不同?这是json语法。除非如何理解哪个是对象或哪个是数组,否则您可以在此站点中检查json和json语法。我看到的问题是,除非这两个条目作为嵌套文档索引,否则原始问题没有得到回答,因为您无法将其索引为单个文档,并将其映射为两个“类型”字段。因为您应该对条目使用任何循环