What is differentce between index and create bulk commands?


(Sam-4) #1

Hi

I'm confuse using index and create bulk command.

{ "index" : { "_index" : "twitter", "_type" : "tweet", "_id" : "1" } }
{ "tweet" : { "text" : "this is a tweet" } }

{ "create" : { "_index" : "twitter", "_type" : "tweet", "_id" :
"1" } }
{ "tweet" : { "text" : "another tweet" } }

when used index or create and what effect happen when using both of
them.

Thanks


(Lukáš Vlček) #2

Hi,

create means that the document is indexed only if it does not exists in
the index yet (recognized by its "_id"), otherwise it will fail.

See "Operation Type" in
http://www.elasticsearch.org/guide/reference/api/index_.html

Regards,
Lukas

On Mon, Jan 9, 2012 at 5:41 AM, sam mishra.sameek@gmail.com wrote:

Hi

I'm confuse using index and create bulk command.

https://github.com/elasticsearch/elasticsearch-river-rabbitmq/blob/master/README.md

{ "index" : { "_index" : "twitter", "_type" : "tweet", "_id" : "1" } }
{ "tweet" : { "text" : "this is a tweet" } }

{ "create" : { "_index" : "twitter", "_type" : "tweet", "_id" :
"1" } }
{ "tweet" : { "text" : "another tweet" } }

when used index or create and what effect happen when using both of
them.

Thanks


(system) #3