Update ops: doc_as_upsert vs upsert properties


(TheDeveloper) #1

What's the difference between doc_as_upsert and upsert properties for
updates?

Documentation
at http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-update.html
seems to describe the same behaviour in different ways: that they update
the given properties in the document if it exists in the index, or are
indexed as the document if not.

Thanks

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Clinton Gormley) #2

upsert is usually used to pass an initial doc when you're using scripts to
update.

doc_as_upsert is used when you're updating using a partial doc. it saves
you from passing the doc twice: one as doc and once as upsert

clint

On 25 October 2013 10:14, Geoff Wagstaff geoff@gosquared.com wrote:

What's the difference between doc_as_upsert and upsert properties for
updates?

Documentation at
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-update.htmlseems to describe the same behaviour in different ways: that they update
the given properties in the document if it exists in the index, or are
indexed as the document if not.

Thanks

--
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.
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.
For more options, visit https://groups.google.com/groups/opt_out.


(TheDeveloper) #3

Hey Clint, thanks for the response.

So when updating, upsert can only be used in conjunction with a script? And
for when you don't need a script you place your doc properties to upsert as
doc and set doc_as_upsert: true?

Geoff

On Friday, October 25, 2013 12:50:52 PM UTC+1, Clinton Gormley wrote:

upsert is usually used to pass an initial doc when you're using scripts to
update.

doc_as_upsert is used when you're updating using a partial doc. it saves
you from passing the doc twice: one as doc and once as upsert

clint

On 25 October 2013 10:14, Geoff Wagstaff <ge...@gosquared.com<javascript:>

wrote:

What's the difference between doc_as_upsert and upsert properties for
updates?

Documentation at
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-update.htmlseems to describe the same behaviour in different ways: that they update
the given properties in the document if it exists in the index, or are
indexed as the document if not.

Thanks

--
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 elasticsearc...@googlegroups.com <javascript:>.
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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4