Separate Documents from log (JSON)

Hi,
I have a json which has array of json objects. I want to create seperate documents for each item inside the array

Example JSON:

{
  "MainID": "12345",
  "MainDocs": [
  {
    "PositionId": "p1",
    "PositionName": "Position 12345"
  },
  {
    "PositionId": "p2",
    "PositionName": "Position 12345"
  },
  ]
}

I want to index it as separate documents to contain MainID and positionID p1 as one document and another document with MainID and positionID p2.

Logstash Configuration

filter {
  json {
    source => "main_json"
    target => "main_data"  
    remove_field => ["main_json"] 
  }

  if [main_data][MainDocs] {
    split {
      field => "[main_data][MainDocs]"
    }
  }
}

I have used split filter. But in elasticsearch it is indexing as a same document with value as arrays.

Example: MainDocs.PositionID = [p1, p2]

Can anyone help me on how to create separate documents for each item inside the array?