How to post a json array to elasticsearch

Thanks Itamar and David so much.
However, I'm not able to use _bulk successfully.

I got error below.
curl -XPOST http://localhost:9200/sg/Location/_bulk --data-binary
"@Location.json"
{"error":"ActionRequestValidationException[Validation Failed: 1: no
requests add
ed;]","status":500}

Location.json
{"Id":"1230","Name":"Melbourne -
Frankston","CityName":"Frankston","Airport":"0","RailwayStation":"0"}
{"Id":"1234","Name":"Geelong","CityName":"Geelong","StateCode":"VIC","Airport":"0","RailwayStation":"0"}

I mapping Id as _id.

On Monday, November 19, 2012 4:28:37 PM UTC+8, David Pilato wrote:

Sorry. I misread your question.

See Bulk indexing.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 19 nov. 2012 à 09:20, David Pilato <da...@pilato.fr <javascript:>> a
écrit :

Welcome !

You have to send valid JSON.

Something like

{ "content" = [
{ "Name" : "aaa","Age" : "20"},
{ "Name" : "bbb","Age" : "30"}
] }

See Elasticsearch Platform — Find real-time answers at scale | Elastic

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 19 nov. 2012 à 09:01, Bill Wang <wiie...@gmail.com <javascript:>> a
écrit :

Hi all,

I'm a newbie here, when I post an item to elasticsearch
curl -XPOST http://localhost:9200/sg/Location -d "@Location.json"

Location.json
{
"Name" : "aaa",
"Age" : "20"
}

However, if I want to post more than 1 item, I tried below
Location.json
[
{ "Name" : "aaa","Age" : "20"},
{ "Name" : "bbb","Age" : "30"}
]
It doesn't work.

somebody could tell me how to reach this.

Thanks,
Bill

--

--

--