Not sure if this is helpful, but doing a similar task via powershell was trivial. I switched to filebeat because it's nice to have those log files in case something breaks and I need to replay everything to build up the indexes again. Not criticizing filebeat here, I understand there are a LOT more features included such as backpressure, just trying to give an example of what I am trying to replicate.
$post_body = @{
@timestamp = $deploy_time
deploy_version = $deploy_version
deploy_targetserver = $deploy_targetserver
deploy_project = $deploy_project
}
$json = $post_body | ConvertTo-Json
$elastic_server = 'http://myelasticserver:9200/octopus/_doc'
$body = $json
Write-Host $body
Invoke-RestMethod -Uri $elastic_server -Method Post -Body $body -ContentType 'application/json'