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.