title: Insert header for each document before uploading to elastic search
body: <p>I have a ndjson file with the below format</p>
  
  <pre><code>{"field1": "data1" , "field2": "data2"}
  {"field1": "data1" , "field2": "data2"}
  ....
  </code></pre>
  
  <p>I want to add a header like</p>
  
  <pre><code>{"index": {}}
  </code></pre>
  
  <p>before each document before using the bulk operation
     I found a similar question: <a href="https://stackoverflow.com/questions/45601344/elasticsearch-bulk-json-data">Elasticsearch Bulk JSON Data</a></p>
  
  <p>The solution is this jq command:</p>
  
  <pre><code>jq -cr ".[]" input.json | while read line; do echo '{"index":{}}'; echo $line; done &gt; bulk.json
  </code></pre>
  
  <p>But I get this error:</p>
  
  <pre><code>'while' is not recognized as a internal or external command
  </code></pre>
  
  <p>What am I doing wrong? Im running Windows
  Or is there a better solution?
  Thanks</p>