Reindex using bulk api

"To reindex all of the documents from the old index efficiently, use scan-and-scroll to retrieve batches of documents from the old index, and the bulk API to push them into the new index."

  1. Is there an example for the above statement? I have followed Index Aliases and Zero Downtime and my existing doc are still under the old index, I want them in my new index (because I have new mapping). Both indices have the same typename.
    What is the exact syntax?
    POST /newIndexName/_bulk { "index" : { "_index" : "oldIndexName" ,"_type" : "theOnlyType" } }
  2. I have elasticsearch 1.7 and I do not see _bulk show up using Sense. As if there is no _bulk API? When I use POST /oldIndexName/_bulk and Sense shows error:JsonParseException[Unexpected end-of-input: expected close marker for OBJECT (from [Source [B@54721lee5; line: 1, column: 0])\n at [Source: [B@54721ee5; line: 1, column:3 ]]", "status": 500}

I just use Logstash with this config - https://gist.github.com/markwalkom/8a7201e3f6ea4354ae06

1 Like