9

I tried backing up and restoring an index to json in Elasticsearch using elasticdump (on Node.js):

[Backup]
elasticdump --input=http://cred:entials@myserver.com:9200/.kibana --output=kibana.json --type=data (Works)

[Restore]
elasticdump --output=http://cred:entials@myserver.com:9200/.kibana --input=kibana.json --type=data (Gives an error)

The error is:

_stream_readable.js:749
    throw new Error('Cannot switch to old mode now.');
          ^
Error: Cannot switch to old mode now.
    at emitDataEvents (_stream_readable.js:749:11)
    at ReadStream.Readable.pause (_stream_readable.js:740:3)
    at file.completeBatch (/usr/lib/node_modules/elasticdump/lib/transports/file.js:75:19)
    at Stream.<anonymous> (/usr/lib/node_modules/elasticdump/lib/transports/file.js:65:10)
    at Stream.emit (events.js:117:20)
    at drain (/usr/lib/node_modules/elasticdump/node_modules/through/index.js:34:23)

Does anyone know what is going and how to fix it?

Phil B
  • 5,589
  • 7
  • 42
  • 58

1 Answers1

9

Your node version is outdated.

Try running node --version and if you get anything below 1.0.0 then you need to upgrade your local version of node.

In order to manage several node versions locally you can use the n module. Simply run the below steps

sudo npm install -g n
sudo n stable

And then you'll have the latest version of node installed and elasticdump will work again.

Val
  • 207,596
  • 13
  • 358
  • 360