Problem with json bulk import to elasticsearch ( jq: error: orders/0 is not defined at <top-level>, line 1: )


I have problem with json bulk importing to elasticsearch. I want to send json data to elasticsearch as bulk request.

My json data looks like this


And this is the command I'm trying to make a bulk request by converting json to bulk doc.

cat order.json | jq -c '.[] | {"index": {"_index": "orders", "_type": "doc"}}, .' | Invoke-RestMethod "http://localhost:9200/orders/doc/_bulk?pretty" -Method Post -ContentType 'application/x-ndjson' -InFile "order.json"

And I'm getting error . I don't know what to do.

I'm Windows user and working with Powershell.

Thanks in advance.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.