mradamlacey / json-to-es-bulk

Utility to create an Elasticsearch bulk request from JSON data
MIT License
62 stars 21 forks source link

Unable to parse? #3

Open awiley-coyote opened 2 years ago

awiley-coyote commented 2 years ago

I am getting this error when trying to run this: Unable to parse input json contents SyntaxError: Unexpected token { in JSON at position 105 at JSON.parse () at Object. (/home/hunter/Desktop/json-to-es-bulk/index.js:51:22) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Function.Module.runMain (internal/modules/cjs/loader.js:831:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3) ReferenceError: exit is not defined at Object. (/home/hunter/Desktop/json-to-es-bulk/index.js:55:5) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Function.Module.runMain (internal/modules/cjs/loader.js:831:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

command I am trying to run is node index.js -f ~/Documents/JSON_Files/Windows.System.DNSCache.json --index dnscache --type _doc

mradamlacey commented 2 years ago

Can you validate your input JSON (~/Documents/JSON_Files/Windows.System.DNSCache.json) is valid? Does it validate in a tool like https://jsonlint.com/ ?