Need help to create mapping

Hi,
Could you please help me to create mapping for the json file in following format

{
"2018-07-22 06:00" : {
"Global Initiatives" : {
"service1" : 0,
"service2" : 0.02,
"service3" : 10
},
"ABC" : {
"service1" : 0,
"service3" : 10
}
},
"2018-07-22 08:00" : {
"Global Initiatives" : {
"service1" : 0.2,
"service2" : 1.02,
"service3" : 20
},
"ABC" : {
"service1" : 30,
"service3" : 100
}
}
}

That looks like a bad format for data to index. Having dynamic keys in the document, e.g. 2018-07-22 08:00, will quickly cause problems as you will create a large number of fields and hit limits. I would recommend you instead restructure the data with separate date fields.

You mean like this:

{
"2018-07-22 06:00" : {
"Global Initiatives" : {
"service1" : 0,
"service2" : 0.02,
"service3" : 10
}
},
"2018-07-22 06:00" : {
"ABC" : {
"service1" : 0,
"service3" : 10
}
},
"2018-07-22 08:00" : {
"Global Initiatives" : {
"service1" : 0.2,
"service2" : 1.02,
"service3" : 20
}
},
"2018-07-22 08:00" : {
"ABC" : {
"service1" : 30,
"service3" : 100
}
},
}

As I do not know your data nor how you want to query it it is tricky, but I was referring to something more like this:

{
  "date": "2018-07-22 06:00",
  "Global Initiatives" : {
    "service1" : 0,
    "service2" : 0.02,
    "service3" : 10
  },
  "ABC" : {
    "service1" : 0,
    "service3" : 10
  }
}

Ok how we would create the mapping for this format. Could you please guide me.

Have you looked at the examples available in the documentation?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.