Error while using Java API for Search on query


(Ravi Dontharaju) #1

Hi,
I am using Elasticsearch 0.18.2. I am trying to connect to port 9300
on localhost.

  • I am able to create documents and get documents by _id on
    elasticsearch using Java API.
    GetResponse response =
    elasticSearchClient
    .prepareGet()
    .setIndex(index)
    .setType(type)
    .setId(id)
    .execute()
    .actionGet();

  • I am able to search using curl/json and I get a valid response and
    hits.
    curl -XPOST 'http://localhost:9200/test/product_data/_search?
    pretty=ok' -d '{
    "query" : {"term" : {"brand" : "toshiba"} }}'

But when I am trying to search using Java API using the following
code:
QueryBuilder qb1 = termQuery("brand", "toshiba");
SearchResponse searchResponse =
elasticSearchClient.prepareSearch("test")
.setTypes("product_data")
.setSearchType(SearchType.DEFAULT)
.setQuery(qb1)
.setFrom(0).setSize(60).setExplain(true)
.execute()
.actionGet();

I get the following error:

2011-11-15 13:34:49,958 [New I/O client worker #1-5] WARN
org.elasticsearch.transport.netty - [Braddock, Elizabeth "Betsy"]
Exception caught on netty layer [[id: 0x1cad7d80, /127.0.0.1:57576 =>
localhost/127.0.0.1:9300]]
java.lang.NoSuchMethodError:
org.apache.lucene.analysis.standard.StandardAnalyzer.(Lorg/
apache/lucene/util/Version;)V
at org.elasticsearch.common.lucene.Lucene.(Lucene.java:
56)
at
org.elasticsearch.search.internal.InternalSearchHit.readFrom(InternalSearchHit.java:
422)
at
org.elasticsearch.search.internal.InternalSearchHit.readSearchHit(InternalSearchHit.java:
403)
at
org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:
211)
at
org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:
191)
at
org.elasticsearch.search.internal.InternalSearchHits.readSearchHits(InternalSearchHits.java:
186)
at
org.elasticsearch.search.internal.InternalSearchResponse.readFrom(InternalSearchResponse.java:
84)
at
org.elasticsearch.search.internal.InternalSearchResponse.readInternalSearchResponse(InternalSearchResponse.java:
79)
at
org.elasticsearch.action.search.SearchResponse.readFrom(SearchResponse.java:
284)
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:
132)
at
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:
111)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:
80)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:
564)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline
$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:
783)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:
302)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:
317)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:
299)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:
216)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:
80)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:
564)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:
559)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:
274)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:
261)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:
349)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:
280)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:
200)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:
108)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker
$1.run(DeadLockProofWorker.java:44)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

Confused as hell, can anyone help?
-Ravi


(Shay Banon) #2

You are missing the lucene jars on the client side. Are you using the
TransportClient? In theory you shouldn't need the Lucene jars for it, but
based on the failure, it seems like it is still required.

On Tue, Nov 15, 2011 at 11:47 PM, Ravi Dontharaju <ravi.dontharaju@gmail.com

wrote:

Hi,
I am using Elasticsearch 0.18.2. I am trying to connect to port 9300
on localhost.

  • I am able to create documents and get documents by _id on
    elasticsearch using Java API.
    GetResponse response =
    elasticSearchClient
    .prepareGet()
    .setIndex(index)
    .setType(type)
    .setId(id)
    .execute()
    .actionGet();

  • I am able to search using curl/json and I get a valid response and
    hits.
    curl -XPOST 'http://localhost:9200/test/product_data/_search?
    pretty=ok' -d '{
    "query" : {"term" : {"brand" : "toshiba"} }}'

But when I am trying to search using Java API using the following
code:
QueryBuilder qb1 = termQuery("brand", "toshiba");
SearchResponse searchResponse =
elasticSearchClient.prepareSearch("test")
.setTypes("product_data")
.setSearchType(SearchType.DEFAULT)
.setQuery(qb1)
.setFrom(0).setSize(60).setExplain(true)
.execute()
.actionGet();

I get the following error:

2011-11-15 13:34:49,958 [New I/O client worker #1-5] WARN
org.elasticsearch.transport.netty - [Braddock, Elizabeth "Betsy"]
Exception caught on netty layer [[id: 0x1cad7d80, /127.0.0.1:57576 =>
localhost/127.0.0.1:9300]]
java.lang.NoSuchMethodError:
org.apache.lucene.analysis.standard.StandardAnalyzer.(Lorg/
apache/lucene/util/Version;)V
at org.elasticsearch.common.lucene.Lucene.(Lucene.java:
56)
at

org.elasticsearch.search.internal.InternalSearchHit.readFrom(InternalSearchHit.java:
422)
at

org.elasticsearch.search.internal.InternalSearchHit.readSearchHit(InternalSearchHit.java:
403)
at

org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:
211)
at

org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:
191)
at

org.elasticsearch.search.internal.InternalSearchHits.readSearchHits(InternalSearchHits.java:
186)
at

org.elasticsearch.search.internal.InternalSearchResponse.readFrom(InternalSearchResponse.java:
84)
at

org.elasticsearch.search.internal.InternalSearchResponse.readInternalSearchResponse(InternalSearchResponse.java:
79)
at

org.elasticsearch.action.search.SearchResponse.readFrom(SearchResponse.java:
284)
at

org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:
132)
at

org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:
111)
at

org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:
80)
at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:
564)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline
$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:
783)
at

org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:
302)
at

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:
317)
at

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:
299)
at

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:
216)
at

org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:
80)
at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:
564)
at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:
559)
at

org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:
274)
at

org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:
261)
at

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:
349)
at

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:
280)
at

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:
200)
at

org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:
108)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker
$1.run(DeadLockProofWorker.java:44)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

Confused as hell, can anyone help?
-Ravi


(Shay Banon) #3

Just double checked and Lucene jar is required for the Explanation...
(which is a Lucene class).

On Wed, Nov 16, 2011 at 4:11 PM, Shay Banon kimchy@gmail.com wrote:

You are missing the lucene jars on the client side. Are you using the
TransportClient? In theory you shouldn't need the Lucene jars for it, but
based on the failure, it seems like it is still required.

On Tue, Nov 15, 2011 at 11:47 PM, Ravi Dontharaju <
ravi.dontharaju@gmail.com> wrote:

Hi,
I am using Elasticsearch 0.18.2. I am trying to connect to port 9300
on localhost.

  • I am able to create documents and get documents by _id on
    elasticsearch using Java API.
    GetResponse response =
    elasticSearchClient
    .prepareGet()
    .setIndex(index)
    .setType(type)
    .setId(id)
    .execute()
    .actionGet();

  • I am able to search using curl/json and I get a valid response and
    hits.
    curl -XPOST 'http://localhost:9200/test/product_data/_search?
    pretty=ok' -d '{
    "query" : {"term" : {"brand" : "toshiba"} }}'

But when I am trying to search using Java API using the following
code:
QueryBuilder qb1 = termQuery("brand", "toshiba");
SearchResponse searchResponse =
elasticSearchClient.prepareSearch("test")
.setTypes("product_data")
.setSearchType(SearchType.DEFAULT)
.setQuery(qb1)
.setFrom(0).setSize(60).setExplain(true)
.execute()
.actionGet();

I get the following error:

2011-11-15 13:34:49,958 [New I/O client worker #1-5] WARN
org.elasticsearch.transport.netty - [Braddock, Elizabeth "Betsy"]
Exception caught on netty layer [[id: 0x1cad7d80, /127.0.0.1:57576 =>
localhost/127.0.0.1:9300]]
java.lang.NoSuchMethodError:
org.apache.lucene.analysis.standard.StandardAnalyzer.(Lorg/
apache/lucene/util/Version;)V
at org.elasticsearch.common.lucene.Lucene.(Lucene.java:
56)
at

org.elasticsearch.search.internal.InternalSearchHit.readFrom(InternalSearchHit.java:
422)
at

org.elasticsearch.search.internal.InternalSearchHit.readSearchHit(InternalSearchHit.java:
403)
at

org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:
211)
at

org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:
191)
at

org.elasticsearch.search.internal.InternalSearchHits.readSearchHits(InternalSearchHits.java:
186)
at

org.elasticsearch.search.internal.InternalSearchResponse.readFrom(InternalSearchResponse.java:
84)
at

org.elasticsearch.search.internal.InternalSearchResponse.readInternalSearchResponse(InternalSearchResponse.java:
79)
at

org.elasticsearch.action.search.SearchResponse.readFrom(SearchResponse.java:
284)
at

org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:
132)
at

org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:
111)
at

org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:
80)
at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:
564)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline
$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:
783)
at

org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:
302)
at

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:
317)
at

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:
299)
at

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:
216)
at

org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:
80)
at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:
564)
at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:
559)
at

org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:
274)
at

org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:
261)
at

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:
349)
at

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:
280)
at

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:
200)
at

org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:
108)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker
$1.run(DeadLockProofWorker.java:44)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

Confused as hell, can anyone help?
-Ravi


(alichi) #4

Shay,
We already have Lucene.jar in CLASSPATH, as a matter and of fact
Lucene dependencies are all added in pom.xml. The funny part is that
we tested successfully with the block below with the same dependency
set:

	QueryStringQueryBuilder queryStringQueryBuilder =

QueryBuilders.queryString(value).field(key, 1);
SearchRequestBuilder srb =
elasticSearchClient.prepareSearch(index).setTypes(type).setQuery(queryStringQueryBuilder);
return srb.execute().actionGet();

So, the question is why this has happened?

On Nov 16, 6:12 am, Shay Banon kim...@gmail.com wrote:

Just double checked and Lucene jar is required for the Explanation...
(which is a Lucene class).

On Wed, Nov 16, 2011 at 4:11 PM, Shay Banon kim...@gmail.com wrote:

You are missing the lucene jars on the client side. Are you using the
TransportClient? In theory you shouldn't need the Lucene jars for it, but
based on the failure, it seems like it is still required.

On Tue, Nov 15, 2011 at 11:47 PM, Ravi Dontharaju <
ravi.donthar...@gmail.com> wrote:

Hi,
I am using Elasticsearch 0.18.2. I am trying to connect to port 9300
on localhost.

  • I am able to create documents and get documents by _id on
    elasticsearch using Java API.
    GetResponse response =
    elasticSearchClient
    .prepareGet()
    .setIndex(index)
    .setType(type)
    .setId(id)
    .execute()
    .actionGet();

But when I am trying to search using Java API using the following
code:
QueryBuilder qb1 = termQuery("brand", "toshiba");
SearchResponse searchResponse =
elasticSearchClient.prepareSearch("test")
.setTypes("product_data")
.setSearchType(SearchType.DEFAULT)
.setQuery(qb1)
.setFrom(0).setSize(60).setExplain(true)
.execute()
.actionGet();

I get the following error:

2011-11-15 13:34:49,958 [New I/O client worker #1-5] WARN
org.elasticsearch.transport.netty - [Braddock, Elizabeth "Betsy"]
Exception caught on netty layer [[id: 0x1cad7d80, /127.0.0.1:57576 =>
localhost/127.0.0.1:9300]]
java.lang.NoSuchMethodError:
org.apache.lucene.analysis.standard.StandardAnalyzer.(Lorg/
apache/lucene/util/Version;)V
at org.elasticsearch.common.lucene.Lucene.(Lucene.java:
56)
at

org.elasticsearch.search.internal.InternalSearchHit.readFrom(InternalSearchHit.java:
422)
at

org.elasticsearch.search.internal.InternalSearchHit.readSearchHit(InternalSearchHit.java:
403)
at

org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:
211)
at

org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:
191)
at

org.elasticsearch.search.internal.InternalSearchHits.readSearchHits(InternalSearchHits.java:
186)
at

org.elasticsearch.search.internal.InternalSearchResponse.readFrom(InternalSearchResponse.java:
84)
at

org.elasticsearch.search.internal.InternalSearchResponse.readInternalSearchResponse(InternalSearchResponse.java:
79)
at

org.elasticsearch.action.search.SearchResponse.readFrom(SearchResponse.java:
284)
at

org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:
132)
at

org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:
111)
at

org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:
80)
at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:
564)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline
$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:
783)
at

org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:
302)
at

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:
317)
at

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:
299)
at

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:
216)
at

org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:
80)
at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:
564)
at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:
559)
at

org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:
274)
at

org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:
261)
at

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:
349)
at

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:
280)
at

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:
200)
at

org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:
108)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker
$1.run(DeadLockProofWorker.java:44)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

Confused as hell, can anyone help?
-Ravi


(K.B.) #5

@ Ali:

are you 100% using same lucene version in your path and ES?
and do you have all (!) required lucene jars in path?
you need:
lucene-analyzers-3.4.0 (this one has the class your error is coming
from)
lucene-core-3.4.0
lucene-highlighter-3.4.0
lucene-memory-3.4.0
lucene-queries-3.4.0
for it to properly work - also note that the versions are set by ES,
meaning my setup is good for ES 0.18.2, but newer needs other
versions, else you will get funny and nearly untracable errors popping
up anywhere;

On 21 Nov., 22:07, Ali loghm...@gmail.com wrote:

Shay,
We already have Lucene.jar in CLASSPATH, as a matter and of fact
Lucene dependencies are all added in pom.xml. The funny part is that
we tested successfully with the block below with the same dependency
set:

            QueryStringQueryBuilder queryStringQueryBuilder =

QueryBuilders.queryString(value).field(key, 1);
SearchRequestBuilder srb =
elasticSearchClient.prepareSearch(index).setTypes(type).setQuery(queryStringQueryBuilder);
return srb.execute().actionGet();

So, the question is why this has happened?

On Nov 16, 6:12 am, Shay Banon kim...@gmail.com wrote:

Just double checked and Lucene jar is required for the Explanation...
(which is a Lucene class).

On Wed, Nov 16, 2011 at 4:11 PM, Shay Banon kim...@gmail.com wrote:

You are missing the lucene jars on the client side. Are you using the
TransportClient? In theory you shouldn't need the Lucene jars for it, but
based on the failure, it seems like it is still required.

On Tue, Nov 15, 2011 at 11:47 PM, Ravi Dontharaju <
ravi.donthar...@gmail.com> wrote:

Hi,
I am using Elasticsearch 0.18.2. I am trying to connect to port 9300
on localhost.

  • I am able to create documents and get documents by _id on
    elasticsearch using Java API.
    GetResponse response =
    elasticSearchClient
    .prepareGet()
    .setIndex(index)
    .setType(type)
    .setId(id)
    .execute()
    .actionGet();

But when I am trying to search using Java API using the following
code:
QueryBuilder qb1 = termQuery("brand", "toshiba");
SearchResponse searchResponse =
elasticSearchClient.prepareSearch("test")
.setTypes("product_data")
.setSearchType(SearchType.DEFAULT)
.setQuery(qb1)
.setFrom(0).setSize(60).setExplain(true)
.execute()
.actionGet();

I get the following error:

2011-11-15 13:34:49,958 [New I/O client worker #1-5] WARN
org.elasticsearch.transport.netty - [Braddock, Elizabeth "Betsy"]
Exception caught on netty layer [[id: 0x1cad7d80, /127.0.0.1:57576 =>
localhost/127.0.0.1:9300]]
java.lang.NoSuchMethodError:
org.apache.lucene.analysis.standard.StandardAnalyzer.(Lorg/
apache/lucene/util/Version;)V
at org.elasticsearch.common.lucene.Lucene.(Lucene.java:
56)
at

org.elasticsearch.search.internal.InternalSearchHit.readFrom(InternalSearchHit.java:
422)
at

org.elasticsearch.search.internal.InternalSearchHit.readSearchHit(InternalSearchHit.java:
403)
at

org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:
211)
at

org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:
191)
at

org.elasticsearch.search.internal.InternalSearchHits.readSearchHits(InternalSearchHits.java:
186)
at

org.elasticsearch.search.internal.InternalSearchResponse.readFrom(InternalSearchResponse.java:
84)
at

org.elasticsearch.search.internal.InternalSearchResponse.readInternalSearchResponse(InternalSearchResponse.java:
79)
at

org.elasticsearch.action.search.SearchResponse.readFrom(SearchResponse.java:
284)
at

org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:
132)
at

org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:
111)
at

org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:
80)
at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:
564)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline
$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:
783)
at

org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:
302)
at

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:
317)
at

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:
299)
at

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:
216)
at

org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:
80)
at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:
564)
at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:
559)
at

org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:
274)
at

org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:
261)
at

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:
349)
at

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:
280)
at

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:
200)
at

org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:
108)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker
$1.run(DeadLockProofWorker.java:44)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

Confused as hell, can anyone help?
-Ravi


(Shay Banon) #6

Nope, you don't have the Lucene jar, its quite obvious from the exception.
The reason the one you just pasted works is because you did not enable
"explain", in which case a Lucene class (Explanation) is not needed.

On Mon, Nov 21, 2011 at 11:07 PM, Ali loghmani@gmail.com wrote:

Shay,
We already have Lucene.jar in CLASSPATH, as a matter and of fact
Lucene dependencies are all added in pom.xml. The funny part is that
we tested successfully with the block below with the same dependency
set:

           QueryStringQueryBuilder queryStringQueryBuilder =

QueryBuilders.queryString(value).field(key, 1);
SearchRequestBuilder srb =

elasticSearchClient.prepareSearch(index).setTypes(type).setQuery(queryStringQueryBuilder);
return srb.execute().actionGet();

So, the question is why this has happened?

On Nov 16, 6:12 am, Shay Banon kim...@gmail.com wrote:

Just double checked and Lucene jar is required for the Explanation...
(which is a Lucene class).

On Wed, Nov 16, 2011 at 4:11 PM, Shay Banon kim...@gmail.com wrote:

You are missing the lucene jars on the client side. Are you using the
TransportClient? In theory you shouldn't need the Lucene jars for it,
but

based on the failure, it seems like it is still required.

On Tue, Nov 15, 2011 at 11:47 PM, Ravi Dontharaju <
ravi.donthar...@gmail.com> wrote:

Hi,
I am using Elasticsearch 0.18.2. I am trying to connect to port 9300
on localhost.

  • I am able to create documents and get documents by _id on
    elasticsearch using Java API.
    GetResponse response =
    elasticSearchClient
    .prepareGet()
    .setIndex(index)
    .setType(type)
    .setId(id)
    .execute()
    .actionGet();

But when I am trying to search using Java API using the following
code:
QueryBuilder qb1 = termQuery("brand", "toshiba");
SearchResponse searchResponse =
elasticSearchClient.prepareSearch("test")
.setTypes("product_data")
.setSearchType(SearchType.DEFAULT)
.setQuery(qb1)
.setFrom(0).setSize(60).setExplain(true)
.execute()
.actionGet();

I get the following error:

2011-11-15 13:34:49,958 [New I/O client worker #1-5] WARN
org.elasticsearch.transport.netty - [Braddock, Elizabeth "Betsy"]
Exception caught on netty layer [[id: 0x1cad7d80, /127.0.0.1:57576 =>
localhost/127.0.0.1:9300]]
java.lang.NoSuchMethodError:
org.apache.lucene.analysis.standard.StandardAnalyzer.(Lorg/
apache/lucene/util/Version;)V
at org.elasticsearch.common.lucene.Lucene.(Lucene.java:
56)
at

org.elasticsearch.search.internal.InternalSearchHit.readFrom(InternalSearchHit.java:

  1. at

org.elasticsearch.search.internal.InternalSearchHit.readSearchHit(InternalSearchHit.java:

  1. at

org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:

  1. at

org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:

  1. at

org.elasticsearch.search.internal.InternalSearchHits.readSearchHits(InternalSearchHits.java:

  1. at

org.elasticsearch.search.internal.InternalSearchResponse.readFrom(InternalSearchResponse.java:

  1. at

org.elasticsearch.search.internal.InternalSearchResponse.readInternalSearchResponse(InternalSearchResponse.java:

  1. at

org.elasticsearch.action.search.SearchResponse.readFrom(SearchResponse.java:

  1. at

org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:

  1. at

org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:

  1. at

org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:

  1. at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:

  1. at
    org.elasticsearch.common.netty.channel.DefaultChannelPipeline

$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:

  1. at

org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:

  1. at

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:

  1. at

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:

  1. at

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:

  1. at

org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:

  1. at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:

  1. at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:

  1. at

org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:

  1. at

org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:

  1. at

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:

  1. at

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:

  1. at

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:

  1. at

org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:

  1. at
    org.elasticsearch.common.netty.util.internal.DeadLockProofWorker
    $1.run(DeadLockProofWorker.java:44)
    at java.util.concurrent.ThreadPoolExecutor
    $Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor
    $Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

Confused as hell, can anyone help?
-Ravi


(system) #7