Hi,

Something like this should work:
----------
"doc['shot.org'] ? doc[’shot.org'].value : ’default_value'"
----------


Masaru


On February 5, 2015 at 10:23:34, 'Selim Tuvi' via elasticsearch 
([email protected]) wrote:
> Actually I am wrong. Looks like some documents did not get created with the
> shot.org field. I am just surprised that the sort script syntax is more
> sensitive compared to the sort field syntax. Is there a way to handle this
> inside the groovy script? I tried checking for null inside the script and
> not returning anything but that didn't help.
>  
> Thanks
> -Selim
>  
> On Wednesday, February 4, 2015 at 3:57:00 PM UTC-8, Selim Tuvi wrote:
> >
> > Actually I fixed my query in Sense, and now I am getting the same error:
> >
> > GET /igo/task/_search
> > {
> > "query": {
> > "match_all": {}
> > },
> > "sort" : [
> > {"_script": {
> > "lang": "groovy",
> > "script": "doc['shot.org'].value",
> > "type": "string",
> > "order":"asc"
> > }}
> > ]
> > }
> >
> > Any ideas why? All documents should have the field "shot.org" for this
> > doc type.
> >
> > -Selim
> >
> >
>  
> --
> 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 [email protected].  
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elasticsearch/5f5d18dc-f4fc-4895-a037-95ddf6613fab%40googlegroups.com.
>   
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/etPan.54d2d11a.12200854.1c2%40citra.local.
For more options, visit https://groups.google.com/d/optout.

Reply via email to