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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -