Automatic document creation using _update

Hi,

Is there any possibility to create document automatically if it does not
exist while calling _update:
curl -XPOST http://localhost:9200/test/type1/1/_update -d '{...}' ?

I do not want to check if the document '1' exists using additional
requests to ES (e.g. curl -XGET http://localhost:9200/test/type1/1) if it
is possible.

Thanks.

Best regards.
Marcin.

There isn't a functionality for this, though you can build it on top of it,
i.e., send an update request, and then send an index (with create flag) to
it if the doc is not found.

On Thu, Apr 19, 2012 at 6:48 PM, Marcin Dojwa m.dojwa@livechatinc.comwrote:

Hi,

Is there any possibility to create document automatically if it does not
exist while calling _update:
curl -XPOST http://localhost:9200/test/type1/1/_update -d '{...}' ?

I do not want to check if the document '1' exists using additional
requests to ES (e.g. curl -XGET http://localhost:9200/test/type1/1) if it
is possible.

Thanks.

Best regards.
Marcin.

Thanks Shay.

W dniu sobota, 21 kwietnia 2012 użytkownik Shay Banon napisał:

There isn't a functionality for this, though you can build it on top of
it, i.e., send an update request, and then send an index (with create flag)
to it if the doc is not found.

On Thu, Apr 19, 2012 at 6:48 PM, Marcin Dojwa <m.dojwa@livechatinc.com<javascript:_e({}, 'cvml', 'm.dojwa@livechatinc.com');>

wrote:

Hi,

Is there any possibility to create document automatically if it does not
exist while calling _update:
curl -XPOST http://localhost:9200/test/type1/1/_update -d '{...}' ?

I do not want to check if the document '1' exists using additional
requests to ES (e.g. curl -XGET http://localhost:9200/test/type1/1) if
it is possible.

Thanks.

Best regards.
Marcin.