Interesting script field nuance on 0.14.2

Hey,
0.14.2 is looking good for us, The highlighting on source cut our
indexes sizes in half, thanks!!!

One thing I noticed is that one of our custom script fields broke with
this error:
Error: statically-typed variable already defined in scope: value

The script was basically:
String value = _source[fieldName];
// Return first x number of chars from the field

I guess the value variable is now defined by ES within the scripts
execution context? Seems like an unlucky collision. My advice is for
ES to prefix all the internal variables in that scope with something
like esInternal.

The update to my script to fix is trivial and similar in the future
can be avoided by using my own prefixing on my vars.

Thanks,
Paul

Err... I think my analysis was off base. Still looking into what my
problem is. Apologies for the noise.

On Jan 12, 2:19 pm, Paul ppea...@gmail.com wrote:

Hey,
0.14.2 is looking good for us, The highlighting on source cut our
indexes sizes in half, thanks!!!

One thing I noticed is that one of our custom script fields broke with
this error:
Error: statically-typed variable already defined in scope: value

The script was basically:
String value = _source[fieldName];
// Return first x number of chars from the field

I guess the value variable is now defined by ES within the scripts
execution context? Seems like an unlucky collision. My advice is for
ES to prefix all the internal variables in that scope with something
like esInternal.

The update to my script to fix is trivial and similar in the future
can be avoided by using my own prefixing on my vars.

Thanks,
Paul

Not sure exactly why, but this had to do with me using a variable
within the context of a script. On 14.2 here this example fails:
scriptBuilder.append("String test = "test";");
scriptBuilder.append("return test.length();");

Don't get why, but I can work directly off the _source variable, so
that makes more sense anyways.

Thanks,
Paul

On Jan 12, 2:36 pm, Paul ppea...@gmail.com wrote:

Err... I think my analysis was off base. Still looking into what my
problem is. Apologies for the noise.

On Jan 12, 2:19 pm, Paul ppea...@gmail.com wrote:

Hey,
0.14.2 is looking good for us, The highlighting on source cut our
indexes sizes in half, thanks!!!

One thing I noticed is that one of our custom script fields broke with
this error:
Error: statically-typed variable already defined in scope: value

The script was basically:
String value = _source[fieldName];
// Return first x number of chars from the field

I guess the value variable is now defined by ES within the scripts
execution context? Seems like an unlucky collision. My advice is for
ES to prefix all the internal variables in that scope with something
like esInternal.

The update to my script to fix is trivial and similar in the future
can be avoided by using my own prefixing on my vars.

Thanks,
Paul

Can you recreate the regression with curl? I will check with mvel.
On Thursday, January 13, 2011 at 12:06 AM, Paul wrote:

Not sure exactly why, but this had to do with me using a variable
within the context of a script. On 14.2 here this example fails:
scriptBuilder.append("String test = "test";");
scriptBuilder.append("return test.length();");

Don't get why, but I can work directly off the _source variable, so
that makes more sense anyways.

Thanks,
Paul

On Jan 12, 2:36 pm, Paul ppea...@gmail.com wrote:

Err... I think my analysis was off base. Still looking into what my
problem is. Apologies for the noise.

On Jan 12, 2:19 pm, Paul ppea...@gmail.com wrote:

Hey,
0.14.2 is looking good for us, The highlighting on source cut our
indexes sizes in half, thanks!!!

One thing I noticed is that one of our custom script fields broke with
this error:
Error: statically-typed variable already defined in scope: value

The script was basically:
String value = _source[fieldName];
// Return first x number of chars from the field

I guess the value variable is now defined by ES within the scripts
execution context? Seems like an unlucky collision. My advice is for
ES to prefix all the internal variables in that scope with something
like esInternal.

The update to my script to fix is trivial and similar in the future
can be avoided by using my own prefixing on my vars.

Thanks,
Paul

Hey Shay,
This simple example should reproduce the issue for you on 0.14.2:

Thanks!

On Jan 12, 3:25 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Can you recreate the regression with curl? I will check with mvel.

On Thursday, January 13, 2011 at 12:06 AM, Paul wrote:

Not sure exactly why, but this had to do with me using a variable
within the context of a script. On 14.2 here this example fails:
scriptBuilder.append("String test = "test";");
scriptBuilder.append("return test.length();");

Don't get why, but I can work directly off the _source variable, so
that makes more sense anyways.

Thanks,
Paul

On Jan 12, 2:36 pm, Paul ppea...@gmail.com wrote:

Err... I think my analysis was off base. Still looking into what my
problem is. Apologies for the noise.

On Jan 12, 2:19 pm, Paul ppea...@gmail.com wrote:

Hey,
0.14.2 is looking good for us, The highlighting on source cut our
indexes sizes in half, thanks!!!

One thing I noticed is that one of our custom script fields broke with
this error:
Error: statically-typed variable already defined in scope: value

The script was basically:
String value = _source[fieldName];
// Return first x number of chars from the field

I guess the value variable is now defined by ES within the scripts
execution context? Seems like an unlucky collision. My advice is for
ES to prefix all the internal variables in that scope with something
like esInternal.

The update to my script to fix is trivial and similar in the future
can be avoided by using my own prefixing on my vars.

Thanks,
Paul

Can you open an issue for this? Just so I won't loose track...
On Wednesday, January 19, 2011 at 8:21 PM, Paul wrote:

Hey Shay,
This simple example should reproduce the issue for you on 0.14.2:
Script field failure · GitHub

Thanks!

On Jan 12, 3:25 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Can you recreate the regression with curl? I will check with mvel.

On Thursday, January 13, 2011 at 12:06 AM, Paul wrote:

Not sure exactly why, but this had to do with me using a variable
within the context of a script. On 14.2 here this example fails:
scriptBuilder.append("String test = "test";");
scriptBuilder.append("return test.length();");

Don't get why, but I can work directly off the _source variable, so
that makes more sense anyways.

Thanks,
Paul

On Jan 12, 2:36 pm, Paul ppea...@gmail.com wrote:

Err... I think my analysis was off base. Still looking into what my
problem is. Apologies for the noise.

On Jan 12, 2:19 pm, Paul ppea...@gmail.com wrote:

Hey,
0.14.2 is looking good for us, The highlighting on source cut our
indexes sizes in half, thanks!!!

One thing I noticed is that one of our custom script fields broke with
this error:
Error: statically-typed variable already defined in scope: value

The script was basically:
String value = _source[fieldName];
// Return first x number of chars from the field

I guess the value variable is now defined by ES within the scripts
execution context? Seems like an unlucky collision. My advice is for
ES to prefix all the internal variables in that scope with something
like esInternal.

The update to my script to fix is trivial and similar in the future
can be avoided by using my own prefixing on my vars.

Thanks,
Paul