Re: Changing response from update from a script

2014-09-24 Thread vineeth mohan
Hello Jennifer ,

I couldn't find any feature for this.
I feel this is a valid use case and i will file a bug on the same.

Thanks
 Vineeth

On Tue, Sep 9, 2014 at 7:19 PM, Jennifer Cumming addedspar...@gmail.com
wrote:

 I have an update script that updates the contents of a nested object array
 and it works fine when everything is fine but sometimes we want to be able
 to reject an update due to invalid parameters (such as a missing mandatory
 field) and return an error.

 I can set the ctx.op to none so that the _version isn't changed but that
 only really works if the version is known before the request is made. So is
 there something in ctx that can be changed so that an error response is
 returned?

 Code would be something like this:

 if (myparam.mandatory == null)
 {
   ctx.op = none
   // more here to return an error response
 }

  --
 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+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/elasticsearch/fffca062-a2d6-441c-97c8-139d7bbabca5%40googlegroups.com
 https://groups.google.com/d/msgid/elasticsearch/fffca062-a2d6-441c-97c8-139d7bbabca5%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.


-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3Dv6uyA3UUwBDjRAMYTa49-Rvtke0mxfKmXy3SwSnMUjw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Changing response from update from a script

2014-09-09 Thread Jennifer Cumming
I have an update script that updates the contents of a nested object array 
and it works fine when everything is fine but sometimes we want to be able 
to reject an update due to invalid parameters (such as a missing mandatory 
field) and return an error.

I can set the ctx.op to none so that the _version isn't changed but that 
only really works if the version is known before the request is made. So is 
there something in ctx that can be changed so that an error response is 
returned?

Code would be something like this:

if (myparam.mandatory == null)
{
  ctx.op = none
  // more here to return an error response
}

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/fffca062-a2d6-441c-97c8-139d7bbabca5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.