Got error at time of bulk insert

my url -> http://localhost:9200/schools/_bulk
post data -> {
"index":{
"_index":"schools", "_type":"school", "_id":"1"
}
}
{
"name":"Central School", "description":"CBSE Affiliation", "street":"Nagan",
"city":"paprola", "state":"HP", "zip":"176115", "location":[31.8955385, 76.8380405],
"fees":2000, "tags":["Senior Secondary", "beautiful campus"], "rating":"3.5"
}
{
"index":{
"_index":"schools", "_type":"school", "_id":"2"
}
}
{
"name":"Saint Paul School", "description":"ICSE
Afiliation", "street":"Dawarka", "city":"Delhi", "state":"Delhi", "zip":"110075",
"location":[28.5733056, 77.0122136], "fees":5000,
"tags":["Good Faculty", "Great Sports"], "rating":"4.5"
}
{
"index":{"_index":"schools", "_type":"school", "_id":"3"}
}
{
"name":"Crescent School", "description":"State Board Affiliation", "street":"Tonk Road",
"city":"Jaipur", "state":"RJ", "zip":"176114","location":[26.8535922, 75.7923988],
"fees":2500, "tags":["Well equipped labs"], "rating":"4.5"
}

error -> "error": "JsonParseException[Unexpected end-of-input: expected close marker for OBJECT (from [Source: [B@65310fe5; line: 1, column: 0])\n at [Source: [B@65310fe5; line: 1, column: 3]]",

please help me for solve this error.

It sounds like the resulting bulk request does not conform to the formatting requirements described here. Each JSON object need to be on a separate, single line ended by a newline.

i got this data form this link "https://www.tutorialspoint.com/elasticsearch/elasticsearch_populate.htm" please check this link

Look at the link I provided. That is the official documentation.

$ curl -X POST "localhost:9200/_bulk" -H 'Content-Type: application/json' -d'

{ "index" : { "_index" : "test", "_type" : "_doc", "_id" : "1" } }
{ "field1" : "value1" }
{ "delete" : { "_index" : "test", "_type" : "_doc", "_id" : "2" } }
{ "create" : { "_index" : "test", "_type" : "_doc", "_id" : "3" } }
{ "field1" : "value3" }
{ "update" : {"_id" : "1", "_type" : "_doc", "_index" : "test"} }
{ "doc" : {"field2" : "value2"} }
'
{"took":15,"errors":true,"items":[{"index":{"_index":"test","_type":"_doc","_id":"1","status":400,"error":"MapperParsingException[mapping [_doc]]; nested: InvalidTypeNameException[mapping type name [doc] can't start with '']; "}},{"index":{"_index":"test","_type":"_doc","_id":"2","status":400,"error":"MapperParsingException[mapping [_doc]]; nested: InvalidTypeNameException[mapping type name [doc] can't start with '']; "}},{"index":{"_index":"test","_type":"_doc","_id":"3","status":400,"error":"MapperParsingException[mapping [_doc]]; nested: InvalidTypeNameException[mapping type name [doc] can't start with '']; "}},{"index":{"_index":"test","_type":"_doc","_id":"1","status":400,"error":"MapperParsingException[mapping [_doc]]; nested: InvalidTypeNameException[mapping type name [doc] can't start with '']; "}}]}

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