Malformed content, found extra data after parsing: START_OBJECT


(jc) #1

Im testing elasticsearch and trying to inject a json file.
For some reason I get "Malformed content, found extra data after parsing: START_OBJECT" error.

Example query:

curl -XPOST 'http://mwdev:9200/test/test/1' -d @test.json

Example content:

{"timestamp":"2016-11-03T01:34:01-04:00","word":"faithful","is_mwu":"no","host":"ws1","ref":"dictionary"}
{"timestamp":"2016-11-03T01:34:02-04:00","word":"drown","is_mwu":"no","host":"ws1","ref":"thesaurus"}
{"timestamp":"2016-11-03T01:34:02-04:00","word":"biggest","is_mwu":"no","host":"ws1","ref":"thesaurus"}
{"timestamp":"2016-11-03T01:34:02-04:00","word":"misconduct","is_mwu":"no","host":"ws1","ref":"thesaurus"}
{"timestamp":"2016-11-03T01:34:03-04:00","word":"transaction","is_mwu":"no","host":"ws1","ref":"dictionary"}
{"timestamp":"2016-11-03T01:34:03-04:00","word":"Pithecus","is_mwu":"no","host":"ws1","ref":"dictionary"}

Any idea why this happens?


(Christian Dahlqvist) #2

That file contain more than one JSON record, which can not be indexed as a single document. If you want to index multiple records in a single request you need to format your file and use the bulk API.


(jc) #3

ah I see. thx


(system) #4

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