NullPointerException when using script based sorting from Python client

Thanks Masaru, I ended up coding this and that worked:

shot = doc['shot.org'].value; if (shot==null) return '';
.
.

-Selim

On Wednesday, February 4, 2015 at 6:10:48 PM UTC-8, Masaru Hasegawa wrote:

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 (
elasti...@googlegroups.com <javascript:>) 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 elasticsearc...@googlegroups.com <javascript:>.
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/605995d9-d3ce-4b34-bdb7-f2932ec4a52c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.