Problem with Preloaded Scripts file size

Hello,
I have a problem with my Preloaded Scripts. If the file is too big ES
doesn't find the file.

For my test the document format is:
{"_index":"test","_type":"res","_id":"1","_version":1,"exists":true,
"_source" : {"test":"1","liste":["a1","a2","a3"]}}

My query:
$data = array('query'=> array('terms'=> array('test'=> array('1'))),
'script_fields'=> array('test1'=>array('script'=>'test')));

And my preloaded scripts, file test.js:

Tab = doc["liste"].values;
test = new Array;
test["a5"] = 274;
test["a4"] = 388;
test["a3"] = 454;
test["a2"] = 339;
test["a1"] = 21;

count = 0;
for (Val in Tab){
if(test[Tab[Val]]==undefined){
add = 1000000;
}
else{
add = test[Tab[Val]];
}

count =  count + add ;

}
count;

If in my preloaded script I have just 1 000 values in the array, there
is no problem.
But if I have more than 10 000 values in the array, I get this error
message
{"took":12,"timed_out":false,"_shards":{"total":5,"successful":
4,"failed":1,"failures":[{"status":
500,"reason":"EcmaError[ReferenceError: "test" n'est pas défini
(Script7.js#1)]"}]},"hits":{"total":1,"max_score":9.24269,"hits":[]}}

What can I do? Because I would like to make some test with more than 1
000 000 values in the array, if it's possible thanks.

A recreation would help, gist the script that fails, and gist curl
recreation and steps. See more at Elasticsearch Platform — Find real-time answers at scale | Elastic. A note
though, initializing an array with 10k values in the script is problematic,
since the script is evaluated fo reach search request (though compiled
once). Maybe the addition of "reference data" script, that is run once and
shared between different execution of the script makes sense in this case,
but that can come later.

On Thu, Nov 24, 2011 at 7:17 PM, alsab alex1.sab@laposte.net wrote:

Hello,
I have a problem with my Preloaded Scripts. If the file is too big ES
doesn't find the file.

For my test the document format is:
{"_index":"test","_type":"res","_id":"1","_version":1,"exists":true,
"_source" : {"test":"1","liste":["a1","a2","a3"]}}

My query:
$data = array('query'=> array('terms'=> array('test'=> array('1'))),
'script_fields'=> array('test1'=>array('script'=>'test')));

And my preloaded scripts, file test.js:

Tab = doc["liste"].values;
test = new Array;
test["a5"] = 274;
test["a4"] = 388;
test["a3"] = 454;
test["a2"] = 339;
test["a1"] = 21;

count = 0;
for (Val in Tab){
if(test[Tab[Val]]==undefined){
add = 1000000;
}
else{
add = test[Tab[Val]];
}

count = count + add ;
}
count;

If in my preloaded script I have just 1 000 values in the array, there
is no problem.
But if I have more than 10 000 values in the array, I get this error
message
{"took":12,"timed_out":false,"_shards":{"total":5,"successful":
4,"failed":1,"failures":[{"status":
500,"reason":"EcmaError[ReferenceError: "test" n'est pas défini
(Script7.js#1)]"}]},"hits":{"total":1,"max_score":9.24269,"hits":}}

What can I do? Because I would like to make some test with more than 1
000 000 values in the array, if it's possible thanks.