Automatic id generation on bulk create


(michael-2) #1

Is it possible to have automatic id generation on bulk create?
What is the syntax? Leaving out the _id?

{ "create" : { "_index" : "test", "_type" : "type1"} }
{ "field1" : "value3" }


(Shay Banon) #2

Yep, this should work.

On Fri, Oct 14, 2011 at 11:36 AM, michael michael.javaone@gmail.com wrote:

Is it possible to have automatic id generation on bulk create?
What is the syntax? Leaving out the _id?

{ "create" : { "_index" : "test", "_type" : "type1"} }
{ "field1" : "value3" }


(Gurram Vinay) #3

Hello ,
I have a doubt at "index,type,id" for elastic search. I had a data and converted in json and seen code below like "index,type,id" of each&every data. How can I actually do it? I've checked some tutorials and could not understand.

Ex:{ "index" : { "index" : "pokedex", "type" : "pokemon", "_id" : "1" } }
{ "ndex": 1, "name": "Bulbasaur" }
{ "index" : { "index" : "pokedex", "type" : "pokemon", "_id" : "2" } }
{ "ndex": 2, "name": "Ivysaur" }
{ "index" : { "index" : "pokedex", "type" : "pokemon", "_id" : "3" } }
{ "ndex": 3, "name": "Venusaur"}

How did we take or automated this format like { "index" : { "index" : "pokedex", "type" : "pokemon", "_id" : "1" } }, here "id" will change everytime along with the data.
Thanks, advance.


(Christian Dahlqvist) #4

Please open a new thread of your own rather than commenting on a thread that is 5 years old.


(system) #5