# Javascript language plugin \_index support

**URL:** <https://discuss.elastic.co/t/javascript-language-plugin--index-support/18219>\
**Category:** Elasticsearch\
**Created:** [June 19, 2014, 6:38pm UTC](https://discuss.elastic.co/t/javascript-language-plugin--index-support/18219 "2014-06-19T18:38:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neeraj\_Makam](https://avatars.discourse-cdn.com/v4/letter/n/94ad74/32.png) [@Neeraj\_Makam](https://discuss.elastic.co/u/Neeraj_Makam)\
**Post date:** [June 19, 2014, 6:38pm UTC](https://discuss.elastic.co/t/javascript-language-plugin--index-support/18219/1 "2014-06-19T18:38:42Z")

</div>

Hi,

i've had few issues with the mvel scripting, so was looking at other  
languages.

1. Is it true that i cant execute more than one sentence in python  
language??
2. When using the javascript language plugin, scripts calling functions  
like "doc['field\_name'].value" OR "\_source.obj1.test" work well.  
But when i'm using functions of \_index, i'm getting the following error:

[2014-06-20 00:06:25,736][DEBUG][action.search.type] [Elfqueen]  
[codeindex][0], node[sPYaZkF7TO6ZFpJ4sGv5Uw], [P], s[STARTED]:\* Failed to  
execut\*  
_e [org.elasticsearch.action.search.SearchRequest@3414a347]_  
_org.mozilla.javascript.EvaluatorException: Invalid JavaScript value of  
type org.elasticsearch.search.lookup.IndexFieldTerm (Script6.js#10)_  
at  
org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:77)  
at  
org.mozilla.javascript.Context.reportRuntimeError(Context.java:913)  
at  
org.mozilla.javascript.Context.reportRuntimeError(Context.java:969)  
at  
org.mozilla.javascript.Context.reportRuntimeError1(Context.java:932)  
at  
org.mozilla.javascript.ScriptRuntime.errorWithClassName(ScriptRuntime.java:3964)  
at  
org.mozilla.javascript.ScriptRuntime.typeof(ScriptRuntime.java:2530)  
at  
org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3786)  
at  
org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2269)  
at  
org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2251)  
at  
org.mozilla.javascript.gen.Script6\_js\_2.\_c\_script\_0(Script6.js:10)  
at org.mozilla.javascript.gen.Script6\_js\_2.call(Script6.js)  
at  
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)  
at  
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)  
at org.mozilla.javascript.gen.Script6\_js\_2.call(Script6.js)  
at org.mozilla.javascript.gen.Script6\_js\_2.exec(Script6.js)  
at  
org.elasticsearch.script.javascript.JavaScriptScriptEngineService$JavaScriptSearchScript.run(JavaScriptScriptEngineService.java:257)  
at  
org.elasticsearch.search.fetch.script.ScriptFieldsFetchSubPhase.hitExecute(ScriptFieldsFetchSubPhase.java:74)  
at  
org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:211)  
at  
org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:340)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction$11.call(SearchServiceTransportAction.java:308)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction$11.call(SearchServiceTransportAction.java:305)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction$23.run(SearchServiceTransportAction.java:517)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown  
Source)  
at java.lang.Thread.run(Unknown Source)  
[2014-06-20 00:06:25,738][DEBUG][action.search.type] [Elfqueen] All  
shards failed for phase: [query\_fetch]

This is the line that is causing the error:  
var term = \_index["content"].get("hello",\_POSITIONS);  
same thing goes with:  
\_index.numDocs() or any of the functions that are called by \_index.

Any solution for this?

--  
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 [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/62c5d5a1-1e77-4837-8efb-bc27726ad2af%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/62c5d5a1-1e77-4837-8efb-bc27726ad2af%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:21am UTC](https://discuss.elastic.co/t/javascript-language-plugin--index-support/18219/2 "2017-07-06T01:21:06Z")

</div>


