Gustavo Chaín
Gustavo Chaín

Reputation: 943

Proper Mapping for dynamic fields

I have the following document structure:

{
  "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"}
  }
}

So I would like to map entries based on the "type" field. Which maping type or flag should I use? Or maybe I need to change my doc structure?

Upvotes: 0

Views: 80

Answers (1)

Could you use this one

{
   "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"
         }
      }]
}

Upvotes: 1

Related Questions