Problem with mvel script on array of geo-points

I have a set of documents with an array of geo-points (the mapping is
enforced). I am trying to run some mvel scripts that generate various
fields based on the lat/long values in the array.

1] This test case works, I do "i = 0; n = 0; d = 0; if
(doc['locs'].values.length > 0) { d = doc['locs'].lons[0]; } d;"

2] This trivial change causes it to fail: "i = 0; n = 0; d = 0; if
(doc['locs'].values.length > 0) { d = doc['locs'].lons[i]; } d;"

(ie I change the index of the lons array to be "i" vs 0; It also fails
with i declared as int, long, Integer, or Long; or the array index
being (int)0, (Integer)0, (long)0, (Long)0)

Am I doing something stupid, is this a bug in mvel (eg a change to JS
will workaround it), or a bug in the ElasticSearch/script interface?

Many thanks, as always, for any insight or help anyone can provide

Alex

Update on this (nobody else using mvel? :P)

The following was a workaround:

"i = 0; d = 0; if (doc['locs'].values.length > 0) { d =
doc['locs'].values[i].lat; } d;"

ie it looks like there's a bug with the ".lats" and ".lons" shortcuts,
I'll go file an issue.

On Jul 19, 10:46 am, Alex at Ikanow apigg...@ikanow.com wrote:

I have a set of documents with an array of geo-points (the mapping is
enforced). I am trying to run some mvel scripts that generate various
fields based on the lat/long values in the array.

1] This test case works, I do "i = 0; n = 0; d = 0; if
(doc['locs'].values.length > 0) { d = doc['locs'].lons[0]; } d;"

Working mvel/geopoint array · GitHub

2] This trivial change causes it to fail: "i = 0; n = 0; d = 0; if
(doc['locs'].values.length > 0) { d = doc['locs'].lons[i]; } d;"

Failing mvel/geopoint array · GitHub

(ie I change the index of the lons array to be "i" vs 0; It also fails
with i declared as int, long, Integer, or Long; or the array index
being (int)0, (Integer)0, (long)0, (Long)0)

Am I doing something stupid, is this a bug in mvel (eg a change to JS
will workaround it), or a bug in the Elasticsearch/script interface?

Many thanks, as always, for any insight or help anyone can provide

Alex

One "final" update:

On Jul 21, 12:45 pm, Alex at Ikanow apigg...@ikanow.com wrote:

Update on this (nobody else using mvel? :P)

The following was a workaround:

"i = 0; d = 0; if (doc['locs'].values.length > 0) { d =
doc['locs'].values[i].lat; } d;"

ie it looks like there's a bug with the ".lats" and ".lons" shortcuts,
I'll go file an issue.

On Jul 19, 10:46 am, Alex at Ikanow apigg...@ikanow.com wrote:

I have a set of documents with an array of geo-points (the mapping is
enforced). I am trying to run some mvel scripts that generate various
fields based on the lat/long values in the array.

1] This test case works, I do "i = 0; n = 0; d = 0; if
(doc['locs'].values.length > 0) { d = doc['locs'].lons[0]; } d;"

Working mvel/geopoint array · GitHub

2] This trivial change causes it to fail: "i = 0; n = 0; d = 0; if
(doc['locs'].values.length > 0) { d = doc['locs'].lons[i]; } d;"

Failing mvel/geopoint array · GitHub

(ie I change the index of the lons array to be "i" vs 0; It also fails
with i declared as int, long, Integer, or Long; or the array index
being (int)0, (Integer)0, (long)0, (Long)0)

Am I doing something stupid, is this a bug in mvel (eg a change to JS
will workaround it), or a bug in the Elasticsearch/script interface?

Many thanks, as always, for any insight or help anyone can provide

Alex