Hello,

I have JavaScript plugin installed. I can use inline javascript for script 
property, but cannot reference a javascript file name similar to article.

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html

I can put a groovy script in there and reference it just fine.

Can you help me, this is my javascript, maybe even help convert into groovy

calculate-scenariotime(match);
function calculate-scenariotime(match) {
    var elapsedtime = new Array();
    var cStart;
    var j = 0;
    for (var i = 0; i < _source.events.length; i++) {
        if (_source.events[i].name === match[j]) {
            if (j === 0) {
                cstart = _source.events[i].start;
            }
            if (j === match.length - 1) {
                var dur = (Date.parse(_source.events[i].end) - 
Date.parse(cstart)) / 1000;
                elapsedtime[elapsedtime.length] = dur;
                j = -1;
            }
            j++;
        }
        else {
            j = 0;
        }
    }
    return elapsedtime;
}

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/1da8db19-4026-4df8-9812-3d0865fc1ce5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to