begin { $JsonStrings = [Collections.Generic.List[String]]::new() } process { foreach ($Object in $InputObject) { $IndexProperties = @{ index = @{ _index = $Index _type = $Type _id = $Id } } $IndexMarker = $IndexProperties | ConvertTo-Json -Compress $Document = $Object | ConvertTo-Json -Compress # Elastic bulk index format $JsonStrings.Add("$IndexMarker`n$Document`n") } } end { Write-Output (-join $JsonStrings) }