Elasticsearch bulk index api via rest endpoint -


here request:

post /_bulk { "index" : { "_index" : "test", "_type" : "type1", "_id" : "1" } } {"firstname":"first_name1","lastname":"last_name1"}, {"firstname":"first_name2","lastname":"last_name2"}, {"firstname":"first_name3","lastname":"last_name3"}} 

here error:

{    "error": "illegalargumentexception[malformed action/metadata line [3], expected start_object or end_object found 

[value_string]]", "status": 500 }

basically, each document {"firstname": ___, "lastname": ____} don't want wrap them parent field. fundamentally missing?

you're missing action line second , third documents, try this:

post /_bulk { "index" : { "_index" : "test", "_type" : "type1", "_id" : "1" } } {"firstname":"first_name1","lastname":"last_name1"} { "index" : { "_index" : "test", "_type" : "type1", "_id" : "2" } } {"firstname":"first_name2","lastname":"last_name2"} { "index" : { "_index" : "test", "_type" : "type1", "_id" : "3" } } {"firstname":"first_name3","lastname":"last_name3"} 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -