适当的动态字段映射

时间:2013-07-08 10:51:17

标签: 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"}
  }
}

所以我想根据“类型”字段映射条目。 我应该使用哪种maping类型或标志? 或者我可能需要更改我的文档结构?

1 个答案:

答案 0 :(得分:1)

你能用这个吗?

{
   "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"
         }
      }]
}
相关问题