Yes meta line is required. You can use bulk for indexing, deleting, updating…
So we need to know what you want to do.
I'm not aware of any "shortcut" like op_type=index which will basically say that only index operations are provided in the JSON stream.
It could be a feature request I guess…
For your last comment, make sure that you don't send too many element per bulk request. I often found (for my use cases) that 10k docs per bulk is enough.
Don't forget that your bulk request needs at some point to be loaded in memory on the node which get the bulk bulk request.
--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr
Le 28 novembre 2013 at 08:36:00, Anders (anders@waglund.se) a écrit:
Has this behavior been changed?
Looking at http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-bulk.html
"The endpoints are /_bulk, /{index}/_bulk, and {index}/type/_bulk. When the index or the index/type are provided, they will be used by default on bulk items that don’t provide them explicitly."
What are the minimal information required for bulk indexing?
http://localhost:9200/sg/Location/_bulk
{ "index" : {"_id" : "1230" } }
{"Id":"1230","Name":"Melbourne - Frankston","CityName":"Frankston","Airport":"0","RailwayStation":"0"}
{ "index" : {"_id" : "1234" } }
{"Id":"1234","Name":"Geelong","CityName":"Geelong","StateCode":"VIC","Airport":"0","RailwayStation":"0"}
Is the meta-line still required? If so, is "_id" still required? Or is { "index" : {} } enough?
Is it feasible to bulk load files with millions of items or should they be divided into smaller chunks? Hundreds of MB, tens of MB or less than 1MB?
Den måndagen den 19:e november 2012 kl. 10:59:24 UTC+1 skrev David Pilato:
You feel that you did redundant code but, in fact, no.
I mean that when you post or put a document with:
http://localhost:9200/sg/Location
or
http://localhost:9200/sg/Location/1230
Elasticsearch find sg as _index, Location as _type and 1230 as _id.
That's why you have to send it within the bulk request even if it's look redundant.
HTH
Le 19 novembre 2012 à 10:22, Bill Wang wiie...@gmail.com a écrit :
Thanks David a lot, you blow me away:)
It works now.
this line looks redundant, is there a way to remove it to make it index automatically by mapping.
{ "index" : { "_index" : "sg" , "_type" : "Location" , "_id" : "1230" } }
like the way curl -XPOST http://localhost:9200/sg/Location -d "{"Id":"1230","Name":"Melbourne - Frankston","CityName":"Frankston","Airport":"0","RailwayStation":"0"}"
On Monday, November 19, 2012 5:06:08 PM UTC+8, David Pilato wrote:
Have a look at http://www.elasticsearch.org/guide/reference/api/bulk.html
Your json file should look like:
{ "index" : { "_index" : "sg", "_type" : "Location", "_id" : "1230" } }
{"Id":"1230","Name":"Melbourne - Frankston","CityName":"Frankston","Airport":"0","RailwayStation":"0"}
{ "index" : { "_index" : "sg", "_type" : "Location", "_id" : "1234" } }
{"Id":"1234","Name":"Geelong","CityName":"Geelong","StateCode":"VIC","Airport":"0","RailwayStation":"0"}
HTH
Le 19 novembre 2012 à 10:01, Bill Wang < wiie...@gmail.com> a écrit :
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
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
Le 19 nov. 2012 à 09:20, David Pilato < da...@pilato.fr > a écrit :
Welcome !
You have to send valid JSON.
Something like
{ "content" = [
{ "Name" : "aaa","Age" : "20"},
{ "Name" : "bbb","Age" : "30"}
] }
See http://www.elasticsearch.org/guide/reference/mapping/array-type.html
--
David
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
Le 19 nov. 2012 à 09:01, Bill Wang < wiie...@gmail.com> 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
--
--
--
--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/d226e9c7-9a47-40a6-8fd5-be7d4a5a2b6c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/etPan.5296ffd2.2cd89a32.3e14%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/groups/opt_out.