"Unknown key for a START_ARRAY in in json

This works well:

DELETE test 
POST test/_doc
{
  "test": [
    {
      " name": " vinay",
      "location": "india"
    },
    {
      "name": "kumar",
      "location": "india2",
      "contactdetails": [
        {
          "phone": "1234",
          "address": "hyd"
        }
      ]
    }
  ]
}

It gives:

{
  "_index" : "test",
  "_type" : "_doc",
  "_id" : "bVTOv3EBJjDNjw2CIKRe",
  "_version" : 1,
  "result" : "created",
  "_shards" : {
    "total" : 2,
    "successful" : 2,
    "failed" : 0
  },
  "_seq_no" : 0,
  "_primary_term" : 1
}

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.