# Specifying different script.lang causes elastic search to timeout

**URL:** <https://discuss.elastic.co/t/specifying-different-script-lang-causes-elastic-search-to-timeout/13574>\
**Category:** Elasticsearch\
**Created:** [September 12, 2013, 6:50pm UTC](https://discuss.elastic.co/t/specifying-different-script-lang-causes-elastic-search-to-timeout/13574 "2013-09-12T18:50:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![davecm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davecm/32/2038_2.png) [@davecm](https://discuss.elastic.co/u/davecm)\
**Post date:** [September 12, 2013, 6:50pm UTC](https://discuss.elastic.co/t/specifying-different-script-lang-causes-elastic-search-to-timeout/13574/1 "2013-09-12T18:50:49Z")

</div>

Hi,  
When I specify a script language, it causes elasticsearch to time out. I  
have tried with lang-python and lang-javascript.  
I'm using ElasticSearch 0.90.3, lang-python 1.2.0 and lang-javascript 1.4.0.

When viewing the console ouput, I see the following:  
Exception in thread "elasticsearch[alt-cluster\_node\_search01][search][T#5]"  
java.lang.AbstractMethodError:  
org.elasticsearch.script.javascript.JavaScriptScriptEngineService$JavaScriptSearchScript.setNextReader(Lorg/apache/lucene/index/IndexReader;)V  
at  
org.elasticsearch.index.query.CustomScoreQueryParser$ScriptScoreFunction.setNextReader(CustomScoreQueryParser.java:116)  
at  
org.elasticsearch.common.lucene.search.function.FunctionScoreQuery$CustomBoostFactorWeight.scorer(FunctionScoreQuery.java:106)  
at  
org.apache.lucene.search.FilteredQuery.getFilteredScorer(FilteredQuery.java:149)  
at org.apache.lucene.search.FilteredQuery$1.scorer(FilteredQuery.java:117)  
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:577)  
at  
org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:195)  
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:445)  
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:426)  
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:342)  
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:330)  
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:178)  
at  
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:234)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:140)  
at  
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:205)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:192)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:178)  
at  
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
at java.lang.Thread.run(Thread.java:679)

The plugin loads when I start ES.

Any ideas are greatly appreciated. Thanks!  
Dave

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![davecm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davecm/32/2038_2.png) [@davecm](https://discuss.elastic.co/u/davecm)\
**Post date:** [September 12, 2013, 7:09pm UTC](https://discuss.elastic.co/t/specifying-different-script-lang-causes-elastic-search-to-timeout/13574/2 "2013-09-12T19:09:06Z")

</div>

Also, the query I am using is below. To make things simple, the custom query script simply returns "1".

The query that times out: (lang: 'js' is specified)  
{'query': {'custom\_score': {'lang': 'js',  
'query': {'filtered': {'filter': {'fquery': {'\_cache': True,  
'query': {'query\_string': {'query': u'django\_ct:(member.subscriber)'}}}},  
'query': {'query\_string': {'analyze\_wildcard': True,  
'auto\_generate\_phrase\_queries': True,  
'default\_field': 'text',  
'default\_operator': 'AND',  
'query': u'(table)'}}}},  
'script': '1'}}}

Same query (without lang: 'js' that works)

{'query': {'custom\_score': {'query': {'filtered': {'filter': {'fquery': {'\_cache': True,  
'query': {'query\_string': {'query': u'django\_ct:(member.subscriber)'}}}},  
'query': {'query\_string': {'analyze\_wildcard': True,  
'auto\_generate\_phrase\_queries': True,  
'default\_field': 'text',  
'default\_operator': 'AND',  
'query': u'(table)'}}}},  
'script': '1'}}}

Dave Brown  
Software Engineer

email [dave@custommade.com](mailto:dave@custommade.com)  
office (617) 231-6301 ext: 1047

On Sep 12, 2013, at 2:50 PM, Dave Brown [dave@custommade.com](mailto:dave@custommade.com) wrote:

> Hi,  
> When I specify a script language, it causes elasticsearch to time out. I have tried with lang-python and lang-javascript.  
> I'm using Elasticsearch 0.90.3, lang-python 1.2.0 and lang-javascript 1.4.0.
> 
> When viewing the console ouput, I see the following:  
> Exception in thread "elasticsearch[alt-cluster\_node\_search01][search][T#5]" java.lang.AbstractMethodError: org.elasticsearch.script.javascript.JavaScriptScriptEngineService$JavaScriptSearchScript.setNextReader(Lorg/apache/lucene/index/IndexReader;)V  
> at org.elasticsearch.index.query.CustomScoreQueryParser$ScriptScoreFunction.setNextReader(CustomScoreQueryParser.java:116)  
> at org.elasticsearch.common.lucene.search.function.FunctionScoreQuery$CustomBoostFactorWeight.scorer(FunctionScoreQuery.java:106)  
> at org.apache.lucene.search.FilteredQuery.getFilteredScorer(FilteredQuery.java:149)  
> at org.apache.lucene.search.FilteredQuery$1.scorer(FilteredQuery.java:117)  
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:577)  
> at org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:195)  
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:445)  
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:426)  
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:342)  
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:330)  
> at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:178)  
> at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:234)  
> at org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:140)  
> at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)  
> at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:205)  
> at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:192)  
> at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:178)  
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)  
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
> at java.lang.Thread.run(Thread.java:679)
> 
> The plugin loads when I start ES.
> 
> Any ideas are greatly appreciated. Thanks!  
> Dave
> 
> --  
> You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/KQHhCIgqYew/unsubscribe](https://groups.google.com/d/topic/elasticsearch/KQHhCIgqYew/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [September 12, 2013, 7:41pm UTC](https://discuss.elastic.co/t/specifying-different-script-lang-causes-elastic-search-to-timeout/13574/3 "2013-09-12T19:41:26Z")

</div>

Hi Dave,  
looks like the elasticsearch jar that is generating the above stacktrace is  
not 0.90.3. It seems at least 0.20, as it's pretty clear it refers Lucene  
3.x. In fact the setNextReader method accepts now an AtomicReaderContext  
instead of IndexReader. The plugin versions you use expose the new version  
of the method, while given the stacktrace elasticsearch is looking for the  
old one.

Could you please make sure you're running the latest version of  
elasticsearch? Or maybe you have collisions in your classpath?

Cheers  
Luca

On Thursday, September 12, 2013 9:09:06 PM UTC+2, Dave Brown wrote:

> Also, the query I am using is below. To make things simple, the custom  
> query script simply returns "1".
> 
> The query that times out: (lang: 'js' is specified)  
> {'query': {'custom\_score': {'lang': 'js',  
> 'query': {'filtered': {'filter': {'fquery': {'\_cache': True,  
> 'query': {'query\_string': {'query':  
> u'django\_ct:(member.subscriber)'}}}},  
> 'query': {'query\_string': {'analyze\_wildcard': True,  
> 'auto\_generate\_phrase\_queries': True,  
> 'default\_field': 'text',  
> 'default\_operator': 'AND',  
> 'query': u'(table)'}}}},  
> 'script': '1'}}}
> 
> Same query (without lang: 'js' that works)
> 
> {'query': {'custom\_score': {'query': {'filtered': {'filter': {'fquery':  
> {'\_cache': True,  
> 'query': {'query\_string': {'query':  
> u'django\_ct:(member.subscriber)'}}}},  
> 'query': {'query\_string': {'analyze\_wildcard': True,  
> 'auto\_generate\_phrase\_queries': True,  
> 'default\_field': 'text',  
> 'default\_operator': 'AND',  
> 'query': u'(table)'}}}},  
> 'script': '1'}}}
> 
> _Dave Brown_  
> Software Engineer
> 
> _email_ [da...@custommade.com](mailto:da...@custommade.com) \<javascript:\>  
> _office_ (617) 231-6301 ext: 1047
> 
> On Sep 12, 2013, at 2:50 PM, Dave Brown \<[da...@custommade.com](mailto:da...@custommade.com)\<javascript:\>\>  
> wrote:
> 
> Hi,  
> When I specify a script language, it causes elasticsearch to time out. I  
> have tried with lang-python and lang-javascript.  
> I'm using Elasticsearch 0.90.3, lang-python 1.2.0 and lang-javascript  
> 1.4.0.
> 
> When viewing the console ouput, I see the following:  
> Exception in thread  
> "elasticsearch[alt-cluster\_node\_search01][search][T#5]"  
> java.lang.AbstractMethodError:  
> org.elasticsearch.script.javascript.JavaScriptScriptEngineService$JavaScriptSearchScript.setNextReader(Lorg/apache/lucene/index/IndexReader;)V  
> at  
> org.elasticsearch.index.query.CustomScoreQueryParser$ScriptScoreFunction.setNextReader(CustomScoreQueryParser.java:116)  
> at  
> org.elasticsearch.common.lucene.search.function.FunctionScoreQuery$CustomBoostFactorWeight.scorer(FunctionScoreQuery.java:106)  
> at  
> org.apache.lucene.search.FilteredQuery.getFilteredScorer(FilteredQuery.java:149)  
> at org.apache.lucene.search.FilteredQuery$1.scorer(FilteredQuery.java:117)  
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:577)  
> at  
> org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:195)  
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:445)  
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:426)  
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:342)  
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:330)  
> at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:178)  
> at  
> org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:234)  
> at  
> org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:140)  
> at  
> org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:205)  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:192)  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:178)  
> at  
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)  
> at  
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
> at java.lang.Thread.run(Thread.java:679)
> 
> The plugin loads when I start ES.
> 
> Any ideas are greatly appreciated. Thanks!  
> Dave
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/KQHhCIgqYew/unsubscribe](https://groups.google.com/d/topic/elasticsearch/KQHhCIgqYew/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![davecm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davecm/32/2038_2.png) [@davecm](https://discuss.elastic.co/u/davecm)\
**Post date:** [September 12, 2013, 7:48pm UTC](https://discuss.elastic.co/t/specifying-different-script-lang-causes-elastic-search-to-timeout/13574/4 "2013-09-12T19:48:03Z")

</div>

That was it! Thanks so much!

Dave Brown  
Software Engineer

email [dave@custommade.com](mailto:dave@custommade.com)  
office (617) 231-6301 ext: 1047

On Sep 12, 2013, at 3:41 PM, Luca Cavanna [cavannaluca@gmail.com](mailto:cavannaluca@gmail.com) wrote:

> Hi Dave,  
> looks like the elasticsearch jar that is generating the above stacktrace is not 0.90.3. It seems at least 0.20, as it's pretty clear it refers Lucene 3.x. In fact the setNextReader method accepts now an AtomicReaderContext instead of IndexReader. The plugin versions you use expose the new version of the method, while given the stacktrace elasticsearch is looking for the old one.
> 
> Could you please make sure you're running the latest version of elasticsearch? Or maybe you have collisions in your classpath?
> 
> Cheers  
> Luca
> 
> On Thursday, September 12, 2013 9:09:06 PM UTC+2, Dave Brown wrote:  
> Also, the query I am using is below. To make things simple, the custom query script simply returns "1".
> 
> The query that times out: (lang: 'js' is specified)  
> {'query': {'custom\_score': {'lang': 'js',  
> 'query': {'filtered': {'filter': {'fquery': {'\_cache': True,  
> 'query': {'query\_string': {'query': u'django\_ct:(member.subscriber)'}}}},  
> 'query': {'query\_string': {'analyze\_wildcard': True,  
> 'auto\_generate\_phrase\_queries': True,  
> 'default\_field': 'text',  
> 'default\_operator': 'AND',  
> 'query': u'(table)'}}}},  
> 'script': '1'}}}
> 
> Same query (without lang: 'js' that works)
> 
> {'query': {'custom\_score': {'query': {'filtered': {'filter': {'fquery': {'\_cache': True,  
> 'query': {'query\_string': {'query': u'django\_ct:(member.subscriber)'}}}},  
> 'query': {'query\_string': {'analyze\_wildcard': True,  
> 'auto\_generate\_phrase\_queries': True,  
> 'default\_field': 'text',  
> 'default\_operator': 'AND',  
> 'query': u'(table)'}}}},  
> 'script': '1'}}}
> 
> Dave Brown  
> Software Engineer
> 
> email [da...@custommade.com](mailto:da...@custommade.com)  
> office (617) 231-6301 ext: 1047
> 
> On Sep 12, 2013, at 2:50 PM, Dave Brown [da...@custommade.com](mailto:da...@custommade.com) wrote:
> 
> > Hi,  
> > When I specify a script language, it causes elasticsearch to time out. I have tried with lang-python and lang-javascript.  
> > I'm using Elasticsearch 0.90.3, lang-python 1.2.0 and lang-javascript 1.4.0.
> > 
> > When viewing the console ouput, I see the following:  
> > Exception in thread "elasticsearch[alt-cluster\_node\_search01][search][T#5]" java.lang.AbstractMethodError: org.elasticsearch.script.javascript.JavaScriptScriptEngineService$JavaScriptSearchScript.setNextReader(Lorg/apache/lucene/index/IndexReader;)V  
> > at org.elasticsearch.index.query.CustomScoreQueryParser$ScriptScoreFunction.setNextReader(CustomScoreQueryParser.java:116)  
> > at org.elasticsearch.common.lucene.search.function.FunctionScoreQuery$CustomBoostFactorWeight.scorer(FunctionScoreQuery.java:106)  
> > at org.apache.lucene.search.FilteredQuery.getFilteredScorer(FilteredQuery.java:149)  
> > at org.apache.lucene.search.FilteredQuery$1.scorer(FilteredQuery.java:117)  
> > at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:577)  
> > at org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:195)  
> > at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:445)  
> > at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:426)  
> > at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:342)  
> > at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:330)  
> > at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:178)  
> > at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:234)  
> > at org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:140)  
> > at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)  
> > at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:205)  
> > at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:192)  
> > at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:178)  
> > at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)  
> > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
> > at java.lang.Thread.run(Thread.java:679)
> > 
> > The plugin loads when I start ES.
> > 
> > Any ideas are greatly appreciated. Thanks!  
> > Dave
> > 
> > --  
> > You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/KQHhCIgqYew/unsubscribe](https://groups.google.com/d/topic/elasticsearch/KQHhCIgqYew/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/KQHhCIgqYew/unsubscribe](https://groups.google.com/d/topic/elasticsearch/KQHhCIgqYew/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:16am UTC](https://discuss.elastic.co/t/specifying-different-script-lang-causes-elastic-search-to-timeout/13574/5 "2017-07-06T02:16:49Z")

</div>


