Native script unable to get values, perhaps because it's a child doc? ES v1.1.1

Hello

I have a native script that I'm using to score/sort queries and it is not
working properly for one of my three types.

All three types have the same nested field, and I'm using the script to
check values and score/sort by an externally defined order. However, for
one of the three types the values pulled from the doc fields are always
zero/null (using docFieldLongs("fieldName").getValue() or
docFieldStrings("stringValue").getValue()). I can check for the fields to
be present using doc().containsKey(), and it seems to see them, but it
never actually sees any values. I've pulled a few records manually and
verified that the data looks good.

The only think I can think of that's different is that this one type is a
child of one of the other two, but I'm querying it completely independently
of the parent in this case. Does this sound familiar to anyone by any
chance?

--
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/5fb79559-7d9f-4a32-a8e1-743876c9a152%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi, did you index the field you want to use in the native script?

Shiwen

On Thursday, 20 November 2014 11:38:30 UTC-8, Jonathan Foy wrote:

Hello

I have a native script that I'm using to score/sort queries and it is not
working properly for one of my three types.

All three types have the same nested field, and I'm using the script to
check values and score/sort by an externally defined order. However, for
one of the three types the values pulled from the doc fields are always
zero/null (using docFieldLongs("fieldName").getValue() or
docFieldStrings("stringValue").getValue()). I can check for the fields to
be present using doc().containsKey(), and it seems to see them, but it
never actually sees any values. I've pulled a few records manually and
verified that the data looks good.

The only think I can think of that's different is that this one type is a
child of one of the other two, but I'm querying it completely independently
of the parent in this case. Does this sound familiar to anyone by any
chance?

--
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/8b01edba-1d36-427d-abfe-48a03f4104a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yep, and I can search on it in other queries.

After testing most of the afternoon, I finally seem to have gotten it to
work by pulling the field using the full name, including the nested path:

Long value = docFieldLongs("nestedPath.propertyName").getValue();

This seems to work in all three places, including the two types that also
worked without the nested path, which is good. Afterwords I came across this
SO post
http://stackoverflow.com/questions/21289149/trouble-with-has-parent-query-containing-scripted-function-score?rq=1
which sounds like a similar problem, though I'm not in a
has_parent/has_child query (though I AM in a child type). Sounds like it
may be a bug.

On Thursday, November 20, 2014 4:00:56 PM UTC-5, Shiwen Cheng wrote:

Hi, did you index the field you want to use in the native script?

Shiwen

On Thursday, 20 November 2014 11:38:30 UTC-8, Jonathan Foy wrote:

Hello

I have a native script that I'm using to score/sort queries and it is not
working properly for one of my three types.

All three types have the same nested field, and I'm using the script to
check values and score/sort by an externally defined order. However, for
one of the three types the values pulled from the doc fields are always
zero/null (using docFieldLongs("fieldName").getValue() or
docFieldStrings("stringValue").getValue()). I can check for the fields to
be present using doc().containsKey(), and it seems to see them, but it
never actually sees any values. I've pulled a few records manually and
verified that the data looks good.

The only think I can think of that's different is that this one type is a
child of one of the other two, but I'm querying it completely independently
of the parent in this case. Does this sound familiar to anyone by any
chance?

--
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/42ed3e0c-e5a9-4673-afb6-9a65213b91c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.