# Help with indexing nested json object

**URL:** <https://discuss.elastic.co/t/help-with-indexing-nested-json-object/31800>\
**Category:** Elasticsearch\
**Created:** [October 7, 2015, 6:49pm UTC](https://discuss.elastic.co/t/help-with-indexing-nested-json-object/31800 "2015-10-07T18:49:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Washaya](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@Michael\_Washaya](https://discuss.elastic.co/u/Michael_Washaya)\
**Post date:** [October 7, 2015, 6:49pm UTC](https://discuss.elastic.co/t/help-with-indexing-nested-json-object/31800/1 "2015-10-07T18:49:06Z")

</div>

how to i index this json object, please help.

[  
{  
"id":1,  
"firstName":"John",  
"lastName":"Smith",  
"sex":"FEMALE",  
"birthdate":1444025680962,  
"address":[{"id":1,"streetName":"100 Nzou Street","surbub":"Mufakose","town":"Harare"}],  
"identification":[{"id":2,"identificationType":"NATIONAL\_ID","value":"42-155800W42"}],  
"contactDetails":[{"contactType":"EMAIL","value":"example@test.com"},{"contactType":"CELLPHONE\_NUMBER","value": "0774100300"}],  
"nextOfKins":[  
{  
"kinId":2,  
"relationshipType":{"name":"Mother","id":1},  
"member":{  
"id":0,  
"firstName":"Ann",  
"lastName":"Matemba",  
"sex":"MALE",  
"birthdate":1444025680964,  
"address":[{  
"id":1,  
"streetName":"100 Nzou Street",  
"surbub":"Mufakose",  
"town":"Harare"}],  
"identification":[{"id":3,"identificationType":"PASSPORT","value":"EN89765"}],  
"contactDetails":[{  
"contactType":"EMAIL",  
"value":"example@test.com"},  
{"contactType":"CELLPHONE\_NUMBER","value":"0774100300"}],  
"nextOfKins":null,  
"birthdateOption":"ACTUAL"}}],  
"birthdateOption":"ACTUAL"},{"id":4,"firstName":"Mirraim","lastName":"Mwashita","sex":"FEMALE","birthdate":1012255200000,"address":null,"identification":null,"contactDetails":null,"nextOfKins":null,"birthdateOption":"ACTUAL"},{"id":5,"firstName":"Vincent","lastName":"Sox","sex":"MALE","birthdate":134604000000,"address":null,"identification":null,"contactDetails":null,"nextOfKins":null,"birthdateOption":"ACTUAL"},{"id":6,"firstName":"Mawoko","lastName":"Mawoko","sex":"MALE","birthdate":null,"address":null,"identification":null,"contactDetails":null,"nextOfKins":null,"birthdateOption":"ESTIMATE"},{"id":7,"firstName":"Goerge","lastName":"Kondo","sex":"MALE","birthdate":1443391200000,"address":null,"identification":null,"contactDetails":null,"nextOfKins":null,"birthdateOption":null}]

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [October 7, 2015, 7:14pm UTC](https://discuss.elastic.co/t/help-with-indexing-nested-json-object/31800/2 "2015-10-07T19:14:29Z")

</div>

Could you explain what you mean by "how do I index"? Elasticsearch should accept pretty much any valid JSON document. What problem are you having?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 7, 2015, 7:33pm UTC](https://discuss.elastic.co/t/help-with-indexing-nested-json-object/31800/3 "2015-10-07T19:33:25Z")

</div>

The only issue I see here is that it is enclosed by `[]`.  
May be he wants to index individual sub records?

You can may be do something like:

```auto
{
  "mystuff": [// YOUR EXAMPLE HERE]
}

```

But as said @magnusbaeck it's hard to understand what you want.

---

<div class="post-metadata">

**Author:** ![Michael\_Washaya](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@Michael\_Washaya](https://discuss.elastic.co/u/Michael_Washaya)\
**Post date:** [October 7, 2015, 7:34pm UTC](https://discuss.elastic.co/t/help-with-indexing-nested-json-object/31800/4 "2015-10-07T19:34:27Z")

</div>

im not well versed with elasticsearch, please bear with me, im using sense and when i use the PUT /people/person/100 together with the valid json, it asks for Expected one of POST or GET though if i execute it indexes, then when i retreive it i get a bad string error along with the object, am i doing something wrong.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:46pm UTC](https://discuss.elastic.co/t/help-with-indexing-nested-json-object/31800/5 "2017-07-05T23:46:05Z")

</div>


