Native(Java) script performance

(avacados-2) #1

is there any documents available about performance of native script ?? I am
facing search performance issue due to native script. General guideline to
optimize script performance will be helpful.

Here is specific details where i am facing performance issue.

I am using script to find documents which overlap betweens two date ranges.
(i.e. find documents between [01-Aug, 2-Nov]... where document contain two
fields (start_time, end_time)) . First, startRange-endRange are params.

My script filter is,

"script": {
"script": "xyz",
"params": {
"startRange": 1407939675, // Timestamp in
"endRange": 1410531675 // Timestamp in
"lang": "native",
"_cache": true

My Native(Java) script code


ScriptDocValues XsDocValue = (ScriptDocValues) doc().get(


long XsLong = 0l;

if (XsDocValue != null && !XsDocValue.isEmpty()) {

XsLong = ((ScriptDocValues.Longs) doc().get("start_time"))



ScriptDocValues XeDocValue = (ScriptDocValues) doc().get("end_time");

long XeLong = 0l;

if (XeDocValue != null && !XeDocValue.isEmpty()) {

XeLong = ((ScriptDocValues.Longs) doc().get("end_time"))



if ((endRange >= XsLong) && (startRange <= XeLong)) {

return true;



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
To view this discussion on the web visit
For more options, visit

(system) #2