Multisearch Java API

Hi,

Does anyone know how I can use the multisearchhttp://www.elasticsearch.org/guide/reference/api/multi-search.htmlfeature using Java API?

I can create a multisearch object but how do I use it to return
MutliSearchResponse?

MultiSearchRequestBuilder multiSearch = new
MultiSearchRequestBuilder(client);
SearchRequestBuilder search =
multiSearch.add(search);

But how do I execute the search and get MultiSearchResponse back?

Any help will be greatly appreciated.

--

Looking at code: https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
I suppose you can write something like:

client.prepareMultiSearch().add(multisearch).execute().actionGet();

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 oct. 2012 à 04:50, bilash ghkawsar@gmail.com a écrit :

Hi,

Does anyone know how I can use the multisearch feature using Java API?

I can create a multisearch object but how do I use it to return MutliSearchResponse?

MultiSearchRequestBuilder multiSearch = new MultiSearchRequestBuilder(client);
SearchRequestBuilder search =
multiSearch.add(search);

But how do I execute the search and get MultiSearchResponse back?

Any help will be greatly appreciated.

--

--

There is not execute method for MultiSearchRequestBuilder that returns a
search response.
Also, there is a no add method that takes MultiSearchRequestBuilder as a
parameter.

On Saturday, October 6, 2012 1:18:24 AM UTC-4, David Pilato wrote:

Looking at code:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
I suppose you can write something like:

client.prepareMultiSearch().add(multisearch).execute().actionGet();

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 oct. 2012 à 04:50, bilash <ghka...@gmail.com <javascript:>> a écrit :

Hi,

Does anyone know how I can use the multisearchhttp://www.elasticsearch.org/guide/reference/api/multi-search.htmlfeature using Java API?

I can create a multisearch object but how do I use it to return
MutliSearchResponse?

MultiSearchRequestBuilder multiSearch = new
MultiSearchRequestBuilder(client);
SearchRequestBuilder search =
multiSearch.add(search);

But how do I execute the search and get MultiSearchResponse back?

Any help will be greatly appreciated.

--

--

Try something like :

SearchRequestBuilder srb1 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your query
here"));

SearchRequestBuilder srb2 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your 2nd query
here"));

MultiSearchResponse sr =
node.client().prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

David

Le 6 octobre 2012 à 08:20, bilash ghkawsar@gmail.com a écrit :

There is not execute method for MultiSearchRequestBuilder that returns a
search response.
Also, there is a no add method that takes MultiSearchRequestBuilder as a
parameter.

On Saturday, October 6, 2012 1:18:24 AM UTC-4, David Pilato wrote:

Looking at code:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
I suppose you can write something like:

client.prepareMultiSearch().add(multisearch).execute().actionGet();
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 oct. 2012 à 04:50, bilash <
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
ghka...@gmail.com> a écrit :

Hi,

Does anyone know how I can use the multisearch
http://www.elasticsearch.org/guide/reference/api/multi-search.html feature
using Java API?

I can create a multisearch object but how do I use it to return
MutliSearchResponse?

MultiSearchRequestBuilder multiSearch = new
MultiSearchRequestBuilder(client);
SearchRequestBuilder search =
multiSearch.add(search);

But how do I execute the search and get MultiSearchResponse back?

Any help will be greatly appreciated.

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

This worked!

Thanks so much David!

On Saturday, October 6, 2012 3:39:32 AM UTC-4, David Pilato wrote:

Try something like :

SearchRequestBuilder srb1 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your
query here"));

SearchRequestBuilder srb2 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your 2nd
query here"));

MultiSearchResponse sr =
node.client().prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

David

Le 6 octobre 2012 à 08:20, bilash <ghka...@gmail.com <javascript:>> a
écrit :

There is not execute method for MultiSearchRequestBuilder that returns a
search response.
Also, there is a no add method that takes MultiSearchRequestBuilder as a
parameter.

On Saturday, October 6, 2012 1:18:24 AM UTC-4, David Pilato wrote:

Looking at code:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
I suppose you can write something like:

client.prepareMultiSearch().add(multisearch).execute().actionGet();https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 oct. 2012 à 04:50, bilash <https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
ghka...@gmail.com> a écrit :

Hi,

Does anyone know how I can use the multisearchhttp://www.elasticsearch.org/guide/reference/api/multi-search.htmlfeature using Java API?

I can create a multisearch object but how do I use it to return
MutliSearchResponse?

MultiSearchRequestBuilder multiSearch = new
MultiSearchRequestBuilder(client);
SearchRequestBuilder search =
multiSearch.add(search);

But how do I execute the search and get MultiSearchResponse back?

Any help will be greatly appreciated.

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

I tried the code above but i am getting exception related TransportSerialization. Below are the details:

Elastic search version: 0.19.10

Code Snippet:

final TransportClient elasticSearchClient = new TransportClient(elasticSearchSettings());
for (final String elasticSearchNode : elasticSearchNodes) {
elasticSearchClient.addTransportAddress(toAddress(elasticSearchNode));
}

.
.
.

//first query
SearchRequestBuilder srb1 = elasticSearchClient.prepareSearch().setTypes(recordType)
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery1));

//second query
SearchRequestBuilder srb2 = elasticSearchClient.prepareSearch(index).setTypes(recordType)
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery2));

//doing multi search
elasticSearchClient.prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

Exception:

org.elasticsearch.transport.TransportSerializationException: Failed to deserialize response of type [org.elasticsearch.action.search.MultiSearchResponse]
at org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:150)
at org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:127)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:458)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:439)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:311)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:94)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:390)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:261)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
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:680)
Caused by: java.io.IOException: Expected handle header, got [80]
at org.elasticsearch.common.io.stream.HandlesStreamInput.readUTF(HandlesStreamInput.java:64)
at org.elasticsearch.search.SearchShardTarget.readFrom(SearchShardTarget.java:97)
at org.elasticsearch.search.SearchShardTarget.readSearchShardTarget(SearchShardTarget.java:81)
at org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:214)
at org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:200)
at org.elasticsearch.search.internal.InternalSearchHits.readSearchHits(InternalSearchHits.java:194)
at org.elasticsearch.search.internal.InternalSearchResponse.readFrom(InternalSearchResponse.java:86)
at org.elasticsearch.search.internal.InternalSearchResponse.readInternalSearchResponse(InternalSearchResponse.java:80)
at org.elasticsearch.action.search.SearchResponse.readFrom(SearchResponse.java:284)
at org.elasticsearch.action.search.MultiSearchResponse$Item.readFrom(MultiSearchResponse.java:86)
at org.elasticsearch.action.search.MultiSearchResponse$Item.readItem(MultiSearchResponse.java:78)
at org.elasticsearch.action.search.MultiSearchResponse.readFrom(MultiSearchResponse.java:135)
at org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:148)
... 22 more

I tried the code above but i am getting
exception TransportSerializationException. Any hints on what could be the
issue? Below are the details:

Elastic search version: 0.19.10

Code Snippet:

final TransportClient elasticSearchClient = new
TransportClient(elasticSearchSettings());
for (final String elasticSearchNode : elasticSearchNodes) {

elasticSearchClient.addTransportAddress(toAddress(elasticSearchNode));
}

.
.
.

//first query
SearchRequestBuilder srb1 =
elasticSearchClient.prepareSearch().setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery1));

//second query
SearchRequestBuilder srb2 =
elasticSearchClient.prepareSearch(index).setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery2));

//doing multi search
elasticSearchClient.prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

Exception:

org.elasticsearch.transport.TransportSerializationException: Failed to
deserialize response of type
[org.elasticsearch.action.search.MultiSearchResponse]
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:150)
at
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:127)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:458)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:439)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:311)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:94)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:390)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:261)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
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:680)
Caused by: java.io.IOException: Expected handle header, got [80]
at
org.elasticsearch.common.io.stream.HandlesStreamInput.readUTF(HandlesStreamInput.java:64)
at
org.elasticsearch.search.SearchShardTarget.readFrom(SearchShardTarget.java:97)
at
org.elasticsearch.search.SearchShardTarget.readSearchShardTarget(SearchShardTarget.java:81)
at
org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:214)
at
org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:200)
at
org.elasticsearch.search.internal.InternalSearchHits.readSearchHits(InternalSearchHits.java:194)
at
org.elasticsearch.search.internal.InternalSearchResponse.readFrom(InternalSearchResponse.java:86)
at
org.elasticsearch.search.internal.InternalSearchResponse.readInternalSearchResponse(InternalSearchResponse.java:80)
at
org.elasticsearch.action.search.SearchResponse.readFrom(SearchResponse.java:284)
at
org.elasticsearch.action.search.MultiSearchResponse$Item.readFrom(MultiSearchResponse.java:86)
at
org.elasticsearch.action.search.MultiSearchResponse$Item.readItem(MultiSearchResponse.java:78)
at
org.elasticsearch.action.search.MultiSearchResponse.readFrom(MultiSearchResponse.java:135)
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:148)
... 22 more

On Sunday, October 7, 2012 10:19:06 AM UTC-7, bilash wrote:

This worked!

Thanks so much David!

On Saturday, October 6, 2012 3:39:32 AM UTC-4, David Pilato wrote:

Try something like :

SearchRequestBuilder srb1 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your
query here"));

SearchRequestBuilder srb2 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your 2nd
query here"));

MultiSearchResponse sr =
node.client().prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

David

Le 6 octobre 2012 à 08:20, bilash ghka...@gmail.com a écrit :

There is not execute method for MultiSearchRequestBuilder that returns a
search response.
Also, there is a no add method that takes MultiSearchRequestBuilder as
a parameter.

On Saturday, October 6, 2012 1:18:24 AM UTC-4, David Pilato wrote:

Looking at code:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
I suppose you can write something like:

client.prepareMultiSearch().add(multisearch).execute().actionGet();https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 oct. 2012 à 04:50, bilash <https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
ghka...@gmail.com> a écrit :

Hi,

Does anyone know how I can use the multisearchhttp://www.elasticsearch.org/guide/reference/api/multi-search.htmlfeature using Java API?

I can create a multisearch object but how do I use it to return
MutliSearchResponse?

MultiSearchRequestBuilder multiSearch = new
MultiSearchRequestBuilder(client);
SearchRequestBuilder search =
multiSearch.add(search);

But how do I execute the search and get MultiSearchResponse back?

Any help will be greatly appreciated.

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

You are probably not using the same version of ES on both sides.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 8 oct. 2012 à 20:44, hemantp hemant.pahilwani@gmail.com a écrit :

I tried the code above but i am getting exception TransportSerializationException. Any hints on what could be the issue? Below are the details:

Elastic search version: 0.19.10

Code Snippet:

final TransportClient elasticSearchClient = new TransportClient(elasticSearchSettings());
for (final String elasticSearchNode : elasticSearchNodes) {
elasticSearchClient.addTransportAddress(toAddress(elasticSearchNode));
}

.
.
.

//first query
SearchRequestBuilder srb1 = elasticSearchClient.prepareSearch().setTypes(recordType)
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery1));

//second query
SearchRequestBuilder srb2 = elasticSearchClient.prepareSearch(index).setTypes(recordType)
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery2));

//doing multi search
elasticSearchClient.prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

Exception:

org.elasticsearch.transport.TransportSerializationException: Failed to deserialize response of type [org.elasticsearch.action.search.MultiSearchResponse]
at org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:150)
at org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:127)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:458)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:439)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:311)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:94)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:390)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:261)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
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:680)
Caused by: java.io.IOException: Expected handle header, got [80]
at org.elasticsearch.common.io.stream.HandlesStreamInput.readUTF(HandlesStreamInput.java:64)
at org.elasticsearch.search.SearchShardTarget.readFrom(SearchShardTarget.java:97)
at org.elasticsearch.search.SearchShardTarget.readSearchShardTarget(SearchShardTarget.java:81)
at org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:214)
at org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:200)
at org.elasticsearch.search.internal.InternalSearchHits.readSearchHits(InternalSearchHits.java:194)
at org.elasticsearch.search.internal.InternalSearchResponse.readFrom(InternalSearchResponse.java:86)
at org.elasticsearch.search.internal.InternalSearchResponse.readInternalSearchResponse(InternalSearchResponse.java:80)
at org.elasticsearch.action.search.SearchResponse.readFrom(SearchResponse.java:284)
at org.elasticsearch.action.search.MultiSearchResponse$Item.readFrom(MultiSearchResponse.java:86)
at org.elasticsearch.action.search.MultiSearchResponse$Item.readItem(MultiSearchResponse.java:78)
at org.elasticsearch.action.search.MultiSearchResponse.readFrom(MultiSearchResponse.java:135)
at org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:148)
... 22 more

On Sunday, October 7, 2012 10:19:06 AM UTC-7, bilash wrote:

This worked!

Thanks so much David!

On Saturday, October 6, 2012 3:39:32 AM UTC-4, David Pilato wrote:

Try something like :

SearchRequestBuilder srb1 = node.client().prepareSearch().setQuery(QueryBuilders.queryString("your query here"));

SearchRequestBuilder srb2 = node.client().prepareSearch().setQuery(QueryBuilders.queryString("your 2nd query here"));

MultiSearchResponse sr = node.client().prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

David

Le 6 octobre 2012 à 08:20, bilash ghka...@gmail.com a écrit :

There is not execute method for MultiSearchRequestBuilder that returns a search response.
Also, there is a no add method that takes MultiSearchRequestBuilder as a parameter.

On Saturday, October 6, 2012 1:18:24 AM UTC-4, David Pilato wrote:
Looking at code: https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
I suppose you can write something like:

client.prepareMultiSearch().add(multisearch).execute().actionGet();

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 oct. 2012 à 04:50, bilash < ghka...@gmail.com> a écrit :

Hi,

Does anyone know how I can use the multisearch feature using Java API?

I can create a multisearch object but how do I use it to return MutliSearchResponse?

MultiSearchRequestBuilder multiSearch = new MultiSearchRequestBuilder(client);
SearchRequestBuilder search =
multiSearch.add(search);

But how do I execute the search and get MultiSearchResponse back?

Any help will be greatly appreciated.

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
--

--

Thanks David, yes i am using spring-Elasticsearch integration 0.0.2 which
pulls in 0.19.4 version of Elasticsearch whereas the server has 0.19.10
deployed on it. Is there any way to make the response compatible or should
i change the version of Elasticsearch server to 0.19.4? are there any
options to make multi query work?

On Monday, October 8, 2012 11:49:22 AM UTC-7, David Pilato wrote:

You are probably not using the same version of ES on both sides.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 8 oct. 2012 à 20:44, hemantp <hemant.p...@gmail.com <javascript:>> a
écrit :

I tried the code above but i am getting
exception TransportSerializationException. Any hints on what could be the
issue? Below are the details:

Elastic search version: 0.19.10

Code Snippet:

final TransportClient elasticSearchClient = new
TransportClient(elasticSearchSettings());
for (final String elasticSearchNode : elasticSearchNodes) {

elasticSearchClient.addTransportAddress(toAddress(elasticSearchNode));
}

.
.
.

//first query
SearchRequestBuilder srb1 =
elasticSearchClient.prepareSearch().setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery1));

//second query
SearchRequestBuilder srb2 =
elasticSearchClient.prepareSearch(index).setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery2));

//doing multi search

elasticSearchClient.prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

Exception:

org.elasticsearch.transport.TransportSerializationException: Failed to
deserialize response of type
[org.elasticsearch.action.search.MultiSearchResponse]
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:150)
at
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:127)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:458)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:439)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:311)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:94)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:390)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:261)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
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:680)
Caused by: java.io.IOException: Expected handle header, got [80]
at
org.elasticsearch.common.io.stream.HandlesStreamInput.readUTF(HandlesStreamInput.java:64)
at
org.elasticsearch.search.SearchShardTarget.readFrom(SearchShardTarget.java:97)
at
org.elasticsearch.search.SearchShardTarget.readSearchShardTarget(SearchShardTarget.java:81)
at
org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:214)
at
org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:200)
at
org.elasticsearch.search.internal.InternalSearchHits.readSearchHits(InternalSearchHits.java:194)
at
org.elasticsearch.search.internal.InternalSearchResponse.readFrom(InternalSearchResponse.java:86)
at
org.elasticsearch.search.internal.InternalSearchResponse.readInternalSearchResponse(InternalSearchResponse.java:80)
at
org.elasticsearch.action.search.SearchResponse.readFrom(SearchResponse.java:284)
at
org.elasticsearch.action.search.MultiSearchResponse$Item.readFrom(MultiSearchResponse.java:86)
at
org.elasticsearch.action.search.MultiSearchResponse$Item.readItem(MultiSearchResponse.java:78)
at
org.elasticsearch.action.search.MultiSearchResponse.readFrom(MultiSearchResponse.java:135)
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:148)
... 22 more

On Sunday, October 7, 2012 10:19:06 AM UTC-7, bilash wrote:

This worked!

Thanks so much David!

On Saturday, October 6, 2012 3:39:32 AM UTC-4, David Pilato wrote:

Try something like :

SearchRequestBuilder srb1 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your
query here"));

SearchRequestBuilder srb2 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your 2nd
query here"));

MultiSearchResponse sr =
node.client().prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

David

Le 6 octobre 2012 à 08:20, bilash ghka...@gmail.com a écrit :

There is not execute method for MultiSearchRequestBuilder that returns
a search response.
Also, there is a no add method that takes MultiSearchRequestBuilder as
a parameter.

On Saturday, October 6, 2012 1:18:24 AM UTC-4, David Pilato wrote:

Looking at code:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
I suppose you can write something like:

client.prepareMultiSearch().add(multisearch).execute().actionGet();https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 oct. 2012 à 04:50, bilash <https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
ghka...@gmail.com> a écrit :

Hi,

Does anyone know how I can use the multisearchhttp://www.elasticsearch.org/guide/reference/api/multi-search.htmlfeature using Java API?

I can create a multisearch object but how do I use it to return
MutliSearchResponse?

MultiSearchRequestBuilder multiSearch = new
MultiSearchRequestBuilder(client);
SearchRequestBuilder search =
multiSearch.add(search);

But how do I execute the search and get MultiSearchResponse back?

Any help will be greatly appreciated.

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--

I did not test it but I think that you can modify your pom.xml to ask for a
0.19.10 version?

If it does not work, it sounds like I have to release a new spring-elasticsearch
version...

Le 8 octobre 2012 à 22:51, hemantp hemant.pahilwani@gmail.com a écrit :

Thanks David, yes i am using spring-Elasticsearch integration 0.0.2 which
pulls in 0.19.4 version of Elasticsearch whereas the server has 0.19.10
deployed on it. Is there any way to make the response compatible or should i
change the version of Elasticsearch server to 0.19.4? are there any options
to make multi query work?

On Monday, October 8, 2012 11:49:22 AM UTC-7, David Pilato wrote:

You are probably not using the same version of ES on both sides.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 8 oct. 2012 à 20:44, hemantp < hemant.p...@gmail.com> a écrit :

I tried the code above but i am getting exception
TransportSerializationException. Any hints on what could be the issue? Below
are the details:

Elastic search version: 0.19.10

Code Snippet:

final TransportClient elasticSearchClient = new
TransportClient(elasticSearchSettings());
for (final String elasticSearchNode : elasticSearchNodes) {

    elasticSearchClient.addTransportAddress(toAddress(elasticSearchNode));

}

.
.
.

//first query
SearchRequestBuilder srb1 =
elasticSearchClient.prepareSearch().setTypes(recordType)

     .setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery1));

//second query
SearchRequestBuilder srb2 =
elasticSearchClient.prepareSearch(index).setTypes(recordType)

      .setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery2));

//doing multi search

elasticSearchClient.prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

Exception:

org.elasticsearch.transport.TransportSerializationException: Failed to
deserialize response of type
[org.elasticsearch.action.search.MultiSearchResponse]
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:150)
at
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:127)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:458)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:439)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:311)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:94)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:390)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:261)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
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:680)
Caused by: java.io.IOException: Expected handle header, got [80]
at
org.elasticsearch.common.io.stream.HandlesStreamInput.readUTF(HandlesStreamInput.java:64)
at
org.elasticsearch.search.SearchShardTarget.readFrom(SearchShardTarget.java:97)
at
org.elasticsearch.search.SearchShardTarget.readSearchShardTarget(SearchShardTarget.java:81)
at
org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:214)
at
org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:200)
at
org.elasticsearch.search.internal.InternalSearchHits.readSearchHits(InternalSearchHits.java:194)
at
org.elasticsearch.search.internal.InternalSearchResponse.readFrom(InternalSearchResponse.java:86)
at
org.elasticsearch.search.internal.InternalSearchResponse.readInternalSearchResponse(InternalSearchResponse.java:80)
at
org.elasticsearch.action.search.SearchResponse.readFrom(SearchResponse.java:284)
at
org.elasticsearch.action.search.MultiSearchResponse$Item.readFrom(MultiSearchResponse.java:86)
at
org.elasticsearch.action.search.MultiSearchResponse$Item.readItem(MultiSearchResponse.java:78)
at
org.elasticsearch.action.search.MultiSearchResponse.readFrom(MultiSearchResponse.java:135)
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:148)
... 22 more

On Sunday, October 7, 2012 10:19:06 AM UTC-7, bilash wrote:
> > > This worked!

 Thanks so much David!


 On Saturday, October 6, 2012 3:39:32 AM UTC-4, David Pilato wrote:
   > > > >        Try something like :
   SearchRequestBuilder srb1 =

node.client().prepareSearch().setQuery(QueryBuilders.queryString("your
query here"));

   SearchRequestBuilder srb2 =

node.client().prepareSearch().setQuery(QueryBuilders.queryString("your
2nd query here"));

   MultiSearchResponse sr =

node.client().prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

   David

   Le 6 octobre 2012 à 08:20, bilash < ghka...@gmail.com> a écrit :

    > > > > > There is not execute method for
    > > > > > MultiSearchRequestBuilder that returns a search
    > > > > > response.
    Also, there is a no add method that takes

MultiSearchRequestBuilder as a parameter.

    On Saturday, October 6, 2012 1:18:24 AM UTC-4, David Pilato

wrote:
> > > > > > Looking at code:
> > > > > > https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
> > > > > > https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

      I suppose you can write something like:

       <https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393>

     client.prepareMultiSearch().add(multisearch).execute().actionGet();

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

      HTH

      --
      David ;-)
      Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

       <https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393>

      Le 6 oct. 2012 à 04:50, bilash <

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
ghka...@gmail.com> a écrit :
Hi,

      Does anyone know how I can use the multisearch

http://www.elasticsearch.org/guide/reference/api/multi-search.html
feature using Java API?

      I can create a multisearch object but how do I use it to

return MutliSearchResponse?

      MultiSearchRequestBuilder multiSearch = new

MultiSearchRequestBuilder(client);
SearchRequestBuilder search =
multiSearch.add(search);

      But how do I execute the search and get

MultiSearchResponse back?

      Any help will be greatly appreciated.




      --





      --


    > > > > > 
    --
    David Pilato
    http://www.scrutmydocs.org/ <http://www.scrutmydocs.org/>
    http://dev.david.pilato.fr/ <http://dev.david.pilato.fr/>
    Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

   > > > >      > > > 
 --

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

I tried doing the maven trick but got the same error:

pom changes:

fr.pilato.spring
spring-elasticsearch
0.0.2


org.elasticsearch
elasticsearch




org.elasticsearch
elasticsearch
0.19.10

Any ideas?

On Monday, October 8, 2012 2:03:40 PM UTC-7, David Pilato wrote:

I did not test it but I think that you can modify your pom.xml to ask
for a 0.19.10 version?

If it does not work, it sounds like I have to release a new
spring-elasticsearch version...

Le 8 octobre 2012 à 22:51, hemantp <hemant.p...@gmail.com <javascript:>>
a écrit :

Thanks David, yes i am using spring-Elasticsearch integration 0.0.2 which
pulls in 0.19.4 version of Elasticsearch whereas the server has 0.19.10
deployed on it. Is there any way to make the response compatible or should
i change the version of Elasticsearch server to 0.19.4? are there any
options to make multi query work?

On Monday, October 8, 2012 11:49:22 AM UTC-7, David Pilato wrote:

You are probably not using the same version of ES on both sides.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 8 oct. 2012 à 20:44, hemantp < hemant.p...@gmail.com> a écrit :

I tried the code above but i am getting
exception TransportSerializationException. Any hints on what could be the
issue? Below are the details:

Elastic search version: 0.19.10

Code Snippet:

final TransportClient elasticSearchClient = new
TransportClient(elasticSearchSettings());
for (final String elasticSearchNode : elasticSearchNodes) {

elasticSearchClient.addTransportAddress(toAddress(elasticSearchNode));
}

.
.
.

//first query
SearchRequestBuilder srb1 =
elasticSearchClient.prepareSearch().setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery1));

//second query
SearchRequestBuilder srb2 =
elasticSearchClient.prepareSearch(index).setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery2));

//doing multi search
elasticSearchClient.prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

Exception:

org.elasticsearch.transport.TransportSerializationException: Failed to
deserialize response of type
[org.elasticsearch.action.search.MultiSearchResponse]
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:150)

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:390)

    at 

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:261)

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)

    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:680)  

Caused by: java.io.IOException: Expected handle header, got [80]
at
org.elasticsearch.common.io.stream.HandlesStreamInput.readUTF(HandlesStreamInput.java:64)

    at 

org.elasticsearch.search.SearchShardTarget.readFrom(SearchShardTarget.java:97)

    at 

org.elasticsearch.search.SearchShardTarget.readSearchShardTarget(SearchShardTarget.java:81)

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.action.search.MultiSearchResponse$Item.readFrom(MultiSearchResponse.java:86)

    at 

org.elasticsearch.action.search.MultiSearchResponse$Item.readItem(MultiSearchResponse.java:78)

    at 

org.elasticsearch.action.search.MultiSearchResponse.readFrom(MultiSearchResponse.java:135)

    at 

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

    ... 22 more 

On Sunday, October 7, 2012 10:19:06 AM UTC-7, bilash wrote:

This worked!

Thanks so much David!

On Saturday, October 6, 2012 3:39:32 AM UTC-4, David Pilato wrote:

Try something like :

SearchRequestBuilder srb1 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your
query here"));

SearchRequestBuilder srb2 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your 2nd
query here"));

MultiSearchResponse sr =
node.client().prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

David

Le 6 octobre 2012 à 08:20, bilash < ghka...@gmail.com> a écrit :

There is not execute method for MultiSearchRequestBuilder that returns a
search response.
Also, there is a no add method that takes MultiSearchRequestBuilder as a
parameter.

On Saturday, October 6, 2012 1:18:24 AM UTC-4, David Pilato wrote:

Looking at code:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
I suppose you can write something like:

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
client.prepareMultiSearch().add(multisearch).execute().actionGet();https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
Le 6 oct. 2012 à 04:50, bilash <https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
ghka...@gmail.com> a écrit :
Hi,

Does anyone know how I can use the multisearchhttp://www.elasticsearch.org/guide/reference/api/multi-search.htmlfeature using Java API?

I can create a multisearch object but how do I use it to return
MutliSearchResponse?

MultiSearchRequestBuilder multiSearch = new
MultiSearchRequestBuilder(client);
SearchRequestBuilder search =
multiSearch.add(search);

But how do I execute the search and get MultiSearchResponse back?

Any help will be greatly appreciated.

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

Just a question: did you clean your project?

I'm asking this because I can see that I can modify the pom.xml with

org.elasticsearch elasticsearch 0.19.10 fr.pilato.spring spring-elasticsearch 0.0.2

and I get elasticsearch-0.19.10.jar in my classpath. :
https://github.com/scrutmydocs/scrutmydocs/blob/master/pom.xml#L138
https://github.com/scrutmydocs/scrutmydocs/blob/master/pom.xml#L138

I did not test it right now.
Please confirm that it works or not. If not, I will have to make deeper tests.

David

Le 9 octobre 2012 à 06:04, hemantp hemant.pahilwani@gmail.com a écrit :

I tried doing the maven trick but got the same error:

pom changes:

fr.pilato.spring
spring-elasticsearch
0.0.2


org.elasticsearch
elasticsearch




org.elasticsearch
elasticsearch
0.19.10

Any ideas?

On Monday, October 8, 2012 2:03:40 PM UTC-7, David Pilato wrote:

I did not test it but I think that you can modify your pom.xml to
ask for a 0.19.10 version?

If it does not work, it sounds like I have to release a new
spring-elasticsearch version...

Le 8 octobre 2012 à 22:51, hemantp < hemant.p...@gmail.com> a écrit :

> > > Thanks David, yes i am using spring-elastic search integration
> > > 0.0.2 which pulls in 0.19.4 version of elastic search whereas the
> > > server has 0.19.10 deployed on it.  Is there any way to make the
> > > response compatible or should i change the version of elastic
> > > search server to 0.19.4? are there any options to make multi query
> > > work?
On Monday, October 8, 2012 11:49:22 AM UTC-7, David Pilato wrote:
  > > > >       You are probably not using the same version of ES on
  > > > > both sides.
  --
  David ;-)
  Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs


  Le 8 oct. 2012 à 20:44, hemantp < hemant.p...@gmail.com> a écrit :
  I tried the code above but i am getting exception

TransportSerializationException. Any hints on what could be the issue?
Below are the details:

  Elastic search version: 0.19.10

  Code Snippet:

  final TransportClient elasticSearchClient = new

TransportClient(elasticSearchSettings());
for (final String elasticSearchNode : elasticSearchNodes) {

       elasticSearchClient.addTransportAddress(toAddress(elasticSearchNode));
  }

  .
  .
  .

  //first query
   SearchRequestBuilder srb1 =

elasticSearchClient.prepareSearch().setTypes(recordType)

        .setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery1));

  //second query
          SearchRequestBuilder srb2 =

elasticSearchClient.prepareSearch(index).setTypes(recordType)

         .setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery2));

  //doing multi search

 elasticSearchClient.prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

  Exception:

  org.elasticsearch.transport.TransportSerializationException:

Failed to deserialize response of type
[org.elasticsearch.action.search.MultiSearchResponse]
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:150)
at
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:127)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:458)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:439)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:311)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:94)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:390)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:261)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
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:680)
Caused by: java.io.IOException: Expected handle header, got [80]
at
org.elasticsearch.common.io.stream.HandlesStreamInput.readUTF(HandlesStreamInput.java:64)
at
org.elasticsearch.search.SearchShardTarget.readFrom(SearchShardTarget.java:97)
at
org.elasticsearch.search.SearchShardTarget.readSearchShardTarget(SearchShardTarget.java:81)
at
org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:214)
at
org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearchHits.java:200)
at
org.elasticsearch.search.internal.InternalSearchHits.readSearchHits(InternalSearchHits.java:194)
at
org.elasticsearch.search.internal.InternalSearchResponse.readFrom(InternalSearchResponse.java:86)
at
org.elasticsearch.search.internal.InternalSearchResponse.readInternalSearchResponse(InternalSearchResponse.java:80)
at
org.elasticsearch.action.search.SearchResponse.readFrom(SearchResponse.java:284)
at
org.elasticsearch.action.search.MultiSearchResponse$Item.readFrom(MultiSearchResponse.java:86)
at
org.elasticsearch.action.search.MultiSearchResponse$Item.readItem(MultiSearchResponse.java:78)
at
org.elasticsearch.action.search.MultiSearchResponse.readFrom(MultiSearchResponse.java:135)
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:148)
... 22 more

  On Sunday, October 7, 2012 10:19:06 AM UTC-7, bilash wrote:
    > > > > > This worked!
    Thanks so much David!


    On Saturday, October 6, 2012 3:39:32 AM UTC-4, David Pilato

wrote:
> > > > > > Try something like :

      SearchRequestBuilder srb1 =

node.client().prepareSearch().setQuery(QueryBuilders.queryString("your
query here"));

      SearchRequestBuilder srb2 =

node.client().prepareSearch().setQuery(QueryBuilders.queryString("your
2nd query here"));

      MultiSearchResponse sr =

node.client().prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

      David

      Le 6 octobre 2012 à 08:20, bilash < ghka...@gmail.com> a

écrit :

       > > > > > > > There is not execute method for
       > > > > > > > MultiSearchRequestBuilder that returns a
       > > > > > > > search response.
       Also, there is a no add method that takes

MultiSearchRequestBuilder as a parameter.

       On Saturday, October 6, 2012 1:18:24 AM UTC-4, David

Pilato wrote:
> > > > > > > > Looking at code:
> > > > > > > > https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
> > > > > > > > https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

         I suppose you can write something like:

          <https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393>

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

        client.prepareMultiSearch().add(multisearch).execute().actionGet();

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

         HTH

         --
         David ;-)
         Twitter : @dadoonet / @elasticsearchfr /

@scrutmydocs

          <https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393>

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

         Le 6 oct. 2012 à 04:50, bilash <

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
ghka...@gmail.com> a écrit :
Hi,

         Does anyone know how I can use the multisearch

http://www.elasticsearch.org/guide/reference/api/multi-search.html
feature using Java API?

         I can create a multisearch object but how do I use

it to return MutliSearchResponse?

         MultiSearchRequestBuilder multiSearch = new

MultiSearchRequestBuilder(client);
SearchRequestBuilder search =
multiSearch.add(search);

         But how do I execute the search and get

MultiSearchResponse back?

         Any help will be greatly appreciated.




         --





         --


       > > > > > > > 
       --
       David Pilato
       http://www.scrutmydocs.org/

http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

      > > > > > >         > > > > > 
    --


  > > > > 
  --




  --
  David Pilato
  http://www.scrutmydocs.org/ <http://www.scrutmydocs.org/>
  http://dev.david.pilato.fr/ <http://dev.david.pilato.fr/>
  Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs



  --




> > > 

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

Yes i did clean the class path and made changes to pom as mentioned above,
i also reinstalled Elasticsearch server again (with one node and one shard
and default index configuration) and created new project just with elastic
search dependency but i am still seeing the issue. Just to make sure that
its not related to my machine or OS, i am planning to do installation on
different OS and trying it out (I am currently testing this on OSX 10.6.8)

On Tuesday, October 9, 2012 1:54:45 AM UTC-7, David Pilato wrote:

Just a question: did you clean your project?

I'm asking this because I can see that I can modify the pom.xml with

org.elasticsearch elasticsearch 0.19.10 fr.pilato.spring spring-elasticsearch 0.0.2 and I get elasticsearch-0.19.10.jar in my classpath. : https://github.com/scrutmydocs/scrutmydocs/blob/master/pom.xml#L138

I did not test it right now.
Please confirm that it works or not. If not, I will have to make deeper
tests.

David

Le 9 octobre 2012 à 06:04, hemantp <hemant.p...@gmail.com <javascript:>>
a écrit :

I tried doing the maven trick but got the same error:

pom changes:

fr.pilato.spring
spring-elasticsearch
0.0.2

org.elasticsearch
elasticsearch




org.elasticsearch
elasticsearch
0.19.10

Any ideas?

On Monday, October 8, 2012 2:03:40 PM UTC-7, David Pilato wrote:

I did not test it but I think that you can modify your pom.xml to ask
for a 0.19.10 version?

If it does not work, it sounds like I have to release a new
spring-elasticsearch version...

Le 8 octobre 2012 à 22:51, hemantp < hemant.p...@gmail.com> a écrit :

Thanks David, yes i am using spring-Elasticsearch integration 0.0.2 which
pulls in 0.19.4 version of Elasticsearch whereas the server has 0.19.10
deployed on it. Is there any way to make the response compatible or should
i change the version of Elasticsearch server to 0.19.4? are there any
options to make multi query work?

On Monday, October 8, 2012 11:49:22 AM UTC-7, David Pilato wrote:

You are probably not using the same version of ES on both sides.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 8 oct. 2012 à 20:44, hemantp < hemant.p...@gmail.com> a écrit :
I tried the code above but i am getting
exception TransportSerializationException. Any hints on what could be the
issue? Below are the details:

Elastic search version: 0.19.10

Code Snippet:

final TransportClient elasticSearchClient = new
TransportClient(elasticSearchSettings());
for (final String elasticSearchNode : elasticSearchNodes) {

elasticSearchClient.addTransportAddress(toAddress(elasticSearchNode));
}

.
.
.

//first query
SearchRequestBuilder srb1 =
elasticSearchClient.prepareSearch().setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery1));

//second query
SearchRequestBuilder srb2 =
elasticSearchClient.prepareSearch(index).setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery2));

//doing multi search
elasticSearchClient.prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

Exception:

org.elasticsearch.transport.TransportSerializationException: Failed to
deserialize response of type
[org.elasticsearch.action.search.MultiSearchResponse]
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:150)

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:390)

    at 

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:261)

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)

    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:680)  

Caused by: java.io.IOException: Expected handle header, got [80]
at
org.elasticsearch.common.io.stream.HandlesStreamInput.readUTF(HandlesStreamInput.java:64)

    at 

org.elasticsearch.search.SearchShardTarget.readFrom(SearchShardTarget.java:97)

    at 

org.elasticsearch.search.SearchShardTarget.readSearchShardTarget(SearchShardTarget.java:81)

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.action.search.MultiSearchResponse$Item.readFrom(MultiSearchResponse.java:86)

    at 

org.elasticsearch.action.search.MultiSearchResponse$Item.readItem(MultiSearchResponse.java:78)

    at 

org.elasticsearch.action.search.MultiSearchResponse.readFrom(MultiSearchResponse.java:135)

    at 

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

    ... 22 more 

On Sunday, October 7, 2012 10:19:06 AM UTC-7, bilash wrote:

This worked!

Thanks so much David!

On Saturday, October 6, 2012 3:39:32 AM UTC-4, David Pilato wrote:

Try something like :

SearchRequestBuilder srb1 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your
query here"));

SearchRequestBuilder srb2 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your 2nd
query here"));

MultiSearchResponse sr =
node.client().prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

David

Le 6 octobre 2012 à 08:20, bilash < ghka...@gmail.com> a écrit :

There is not execute method for MultiSearchRequestBuilder that returns a
search response.
Also, there is a no add method that takes MultiSearchRequestBuilder as a
parameter.

On Saturday, October 6, 2012 1:18:24 AM UTC-4, David Pilato wrote:

Looking at code:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
I suppose you can write something like:

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393 https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
client.prepareMultiSearch().add(multisearch).execute().actionGet();https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393 https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
Le 6 oct. 2012 à 04:50, bilash <https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
ghka...@gmail.com> a écrit :
Hi,

Does anyone know how I can use the multisearchhttp://www.elasticsearch.org/guide/reference/api/multi-search.htmlfeature using Java API?

I can create a multisearch object but how do I use it to return
MutliSearchResponse?

MultiSearchRequestBuilder multiSearch = new
MultiSearchRequestBuilder(client);
SearchRequestBuilder search =
multiSearch.add(search);

But how do I execute the search and get MultiSearchResponse back?

Any help will be greatly appreciated.

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

Hi,

Did you try it out ? Does it work now?

David

De : elasticsearch@googlegroups.com [mailto:elasticsearch@googlegroups.com]
De la part de hemantp
Envoyé : mardi 9 octobre 2012 19:34
À : elasticsearch@googlegroups.com
Cc : David Pilato
Objet : Re: Multisearch Java API

Yes i did clean the class path and made changes to pom as mentioned above, i
also reinstalled elastic search server again (with one node and one shard
and default index configuration) and created new project just with elastic
search dependency but i am still seeing the issue. Just to make sure that
its not related to my machine or OS, i am planning to do installation on
different OS and trying it out (I am currently testing this on OSX 10.6.8)

On Tuesday, October 9, 2012 1:54:45 AM UTC-7, David Pilato wrote:

Just a question: did you clean your project?

I'm asking this because I can see that I can modify the pom.xml with

org.elasticsearch elasticsearch 0.19.10 fr.pilato.spring spring-elasticsearch 0.0.2

and I get elasticsearch-0.19.10.jar in my classpath. :

I did not test it right now.

Please confirm that it works or not. If not, I will have to make deeper
tests.

David

Le 9 octobre 2012 à 06:04, hemantp <hemant.p...@gmail.com <javascript:> > a
écrit :

I tried doing the maven trick but got the same error:

pom changes:

          <dependency> 

fr.pilato.spring

spring-elasticsearch

0.0.2

                                    <groupId>org.elasticsearch</groupId>

elasticsearch

</dependency> 

<dependency> 

org.elasticsearch

elasticsearch

0.19.10

</dependency> 

Any ideas?

On Monday, October 8, 2012 2:03:40 PM UTC-7, David Pilato wrote:

I did not test it but I think that you can modify your pom.xml to ask for a
0.19.10 version?

If it does not work, it sounds like I have to release a new
spring-elasticsearch version...

Le 8 octobre 2012 à 22:51, hemantp < hemant.p...@gmail.com> a écrit :

Thanks David, yes i am using spring-elastic search integration 0.0.2 which
pulls in 0.19.4 version of elastic search whereas the server has 0.19.10
deployed on it. Is there any way to make the response compatible or should
i change the version of elastic search server to 0.19.4? are there any
options to make multi query work?

On Monday, October 8, 2012 11:49:22 AM UTC-7, David Pilato wrote:

You are probably not using the same version of ES on both sides.

--

David :wink:

Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 8 oct. 2012 à 20:44, hemantp < hemant.p...@gmail.com> a écrit :

I tried the code above but i am getting exception
TransportSerializationException. Any hints on what could be the issue? Below
are the details:

Elastic search version: 0.19.10

Code Snippet:

final TransportClient elasticSearchClient = new
TransportClient(elasticSearchSettings());

for (final String elasticSearchNode : elasticSearchNodes) {

  elasticSearchClient.addTransportAddress(toAddress(elasticSearchNode));

}

.

.

.

//first query

SearchRequestBuilder srb1 =
elasticSearchClient.prepareSearch().setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.query
String(myQuery1));

//second query

    SearchRequestBuilder srb2 =

elasticSearchClient.prepareSearch(index).setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.query
String(myQuery2));

//doing multi search

elasticSearchClient.prepareMultiSearch().add(srb1).add(srb2).execute().actio
nGet();

Exception:

org.elasticsearch.transport.TransportSerializationException: Failed to
deserialize response of type
[org.elasticsearch.action.search.MultiSearchResponse]

    at

org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(Messa
geChannelHandler.java:150)

    at

org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(Mess
ageChannelHandler.java:127)

    at

org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUp
stream(SimpleChannelUpstreamHandler.java:75)

    at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(D
efaultChannelPipeline.java:565)

    at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannel
HandlerContext.sendUpstream(DefaultChannelPipeline.java:793)

    at

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

    at

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFir
eMessageReceived(FrameDecoder.java:458)

    at

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(F
rameDecoder.java:439)

    at

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageRecei
ved(FrameDecoder.java:311)

    at

org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUp
stream(SimpleChannelUpstreamHandler.java:75)

    at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(D
efaultChannelPipeline.java:565)

    at

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(D
efaultChannelPipeline.java:560)

    at

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

    at

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

    at

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.j
ava:94)

    at

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processS
electedKeys(AbstractNioWorker.java:390)

    at

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(Abst
ractNioWorker.java:261)

    at

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.ja
va:35)

    at

org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamin
gRunnable.java:102)

    at

org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadL
ockProofWorker.java:42)

    at

java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.ja
va:886)

    at

java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:9
08)

    at java.lang.Thread.run(Thread.java:680)  

Caused by: java.io.IOException: Expected handle header, got [80]

    at

org.elasticsearch.common.io.stream.HandlesStreamInput.readUTF(HandlesStreamI
nput.java:64)

    at

org.elasticsearch.search.SearchShardTarget.readFrom(SearchShardTarget.java:9
7)

    at

org.elasticsearch.search.SearchShardTarget.readSearchShardTarget(SearchShard
Target.java:81)

    at

org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearch
Hits.java:214)

    at

org.elasticsearch.search.internal.InternalSearchHits.readFrom(InternalSearch
Hits.java:200)

    at

org.elasticsearch.search.internal.InternalSearchHits.readSearchHits(Internal
SearchHits.java:194)

    at

org.elasticsearch.search.internal.InternalSearchResponse.readFrom(InternalSe
archResponse.java:86)

    at

org.elasticsearch.search.internal.InternalSearchResponse.readInternalSearchR
esponse(InternalSearchResponse.java:80)

    at

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

    at

org.elasticsearch.action.search.MultiSearchResponse$Item.readFrom(MultiSearc
hResponse.java:86)

    at

org.elasticsearch.action.search.MultiSearchResponse$Item.readItem(MultiSearc
hResponse.java:78)

    at

org.elasticsearch.action.search.MultiSearchResponse.readFrom(MultiSearchResp
onse.java:135)

    at

org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(Messa
geChannelHandler.java:148)

    ... 22 more 

On Sunday, October 7, 2012 10:19:06 AM UTC-7, bilash wrote:

This worked!

Thanks so much David!

On Saturday, October 6, 2012 3:39:32 AM UTC-4, David Pilato wrote:

Try something like :

SearchRequestBuilder srb1 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your query
here"));

SearchRequestBuilder srb2 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your 2nd
query here"));

MultiSearchResponse sr =
node.client().prepareMultiSearch().add(srb1).add(srb2).execute().actionGet()
;

David

Le 6 octobre 2012 à 08:20, bilash < ghka...@gmail.com> a écrit :

There is not execute method for MultiSearchRequestBuilder that returns a
search response.
Also, there is a no add method that takes MultiSearchRequestBuilder as a
parameter.

On Saturday, October 6, 2012 1:18:24 AM UTC-4, David Pilato wrote:

Looking at code:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org
/elasticsearch/client/Client.java#L393

I suppose you can write something like:

client.prepareMultiSearch().add(multisearch).execute().actionGet();
<https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/or
g/elasticsearch/client/Client.java#L393>

HTH

--

David :wink:

Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

<https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/or
g/elasticsearch/client/Client.java#L393>
Le 6 oct. 2012 à 04:50, bilash < ghka...@gmail.com> a écrit :

Hi,

Does anyone know how I can use the multisearch
http://www.elasticsearch.org/guide/reference/api/multi-search.html
feature using Java API?

I can create a multisearch object but how do I use it to return
MutliSearchResponse?

MultiSearchRequestBuilder multiSearch = new
MultiSearchRequestBuilder(client);
SearchRequestBuilder search =
multiSearch.add(search);

But how do I execute the search and get MultiSearchResponse back?

Any help will be greatly appreciated.

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--

Hi David, Sorry i was away for a while. I havent tried it yet. Is there
any recommended os version where i should be trying??

On Wednesday, October 17, 2012 10:41:23 AM UTC-7, David Pilato wrote:

Hi,

Did you try it out ? Does it work now?

David

De : elasti...@googlegroups.com <javascript:> [mailto:
elasti...@googlegroups.com <javascript:>] De la part de hemantp
Envoyé : mardi 9 octobre 2012 19:34
À : elasti...@googlegroups.com <javascript:>
Cc : David Pilato
Objet : Re: Multisearch Java API

Yes i did clean the class path and made changes to pom as mentioned above,
i also reinstalled Elasticsearch server again (with one node and one shard
and default index configuration) and created new project just with elastic
search dependency but i am still seeing the issue. Just to make sure that
its not related to my machine or OS, i am planning to do installation on
different OS and trying it out (I am currently testing this on OSX 10.6.8)

On Tuesday, October 9, 2012 1:54:45 AM UTC-7, David Pilato wrote:

Just a question: did you clean your project?

I'm asking this because I can see that I can modify the pom.xml with

org.elasticsearch elasticsearch 0.19.10 fr.pilato.spring spring-elasticsearch 0.0.2

and I get elasticsearch-0.19.10.jar in my classpath. :
https://github.com/scrutmydocs/scrutmydocs/blob/master/pom.xml#L138

I did not test it right now.

Please confirm that it works or not. If not, I will have to make deeper
tests.

David

Le 9 octobre 2012 à 06:04, hemantp hemant.p...@gmail.com a écrit :

I tried doing the maven trick but got the same error:

pom changes:

          <dependency> 

fr.pilato.spring

spring-elasticsearch

0.0.2

org.elasticsearch

elasticsearch

</dependency> 

<dependency> 

org.elasticsearch

elasticsearch

0.19.10

</dependency> 

Any ideas?

On Monday, October 8, 2012 2:03:40 PM UTC-7, David Pilato wrote:

I did not test it but I think that you can modify your pom.xml to ask for
a 0.19.10 version?

If it does not work, it sounds like I have to release a new
spring-elasticsearch version...

Le 8 octobre 2012 à 22:51, hemantp < hemant.p...@gmail.com> a écrit :

Thanks David, yes i am using spring-Elasticsearch integration 0.0.2 which
pulls in 0.19.4 version of Elasticsearch whereas the server has 0.19.10
deployed on it. Is there any way to make the response compatible or should
i change the version of Elasticsearch server to 0.19.4? are there any
options to make multi query work?

On Monday, October 8, 2012 11:49:22 AM UTC-7, David Pilato wrote:

You are probably not using the same version of ES on both sides.

--

David :wink:

Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 8 oct. 2012 à 20:44, hemantp < hemant.p...@gmail.com> a écrit :

I tried the code above but i am getting
exception TransportSerializationException. Any hints on what could be the
issue? Below are the details:

Elastic search version: 0.19.10

Code Snippet:

final TransportClient elasticSearchClient = new
TransportClient(elasticSearchSettings());

for (final String elasticSearchNode : elasticSearchNodes) {

elasticSearchClient.addTransportAddress(toAddress(elasticSearchNode));

}

.

.

.

//first query

SearchRequestBuilder srb1 =
elasticSearchClient.prepareSearch().setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery1));

//second query

    SearchRequestBuilder srb2 = 

elasticSearchClient.prepareSearch(index).setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery2));

//doing multi search

elasticSearchClient.prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

Exception:

org.elasticsearch.transport.TransportSerializationException: Failed to
deserialize response of type
[org.elasticsearch.action.search.MultiSearchResponse]

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:390)

    at 

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:261)

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)

    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:680)  

Caused by: java.io.IOException: Expected handle header, got [80]

    at 

org.elasticsearch.common.io.stream.HandlesStreamInput.readUTF(HandlesStreamInput.java:64)

    at 

org.elasticsearch.search.SearchShardTarget.readFrom(SearchShardTarget.java:97)

    at 

org.elasticsearch.search.SearchShardTarget.readSearchShardTarget(SearchShardTarget.java:81)

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.action.search.MultiSearchResponse$Item.readFrom(MultiSearchResponse.java:86)

    at 

org.elasticsearch.action.search.MultiSearchResponse$Item.readItem(MultiSearchResponse.java:78)

    at 

org.elasticsearch.action.search.MultiSearchResponse.readFrom(MultiSearchResponse.java:135)

    at 

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

    ... 22 more 

On Sunday, October 7, 2012 10:19:06 AM UTC-7, bilash wrote:

This worked!

Thanks so much David!

On Saturday, October 6, 2012 3:39:32 AM UTC-4, David Pilato wrote:

Try something like :

SearchRequestBuilder srb1 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your
query here"));

SearchRequestBuilder srb2 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your 2nd
query here"));

MultiSearchResponse sr =
node.client().prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

David

Le 6 octobre 2012 à 08:20, bilash < ghka...@gmail.com> a écrit :

There is not execute method for MultiSearchRequestBuilder that returns a
search response.
Also, there is a no add method that takes MultiSearchRequestBuilder as a
parameter.

On Saturday, October 6, 2012 1:18:24 AM UTC-4, David Pilato wrote:

Looking at code:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

I suppose you can write something like:

client.prepareMultiSearch().add(multisearch).execute().actionGet();https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

HTH

--

David :wink:

Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 oct. 2012 à 04:50, bilash <https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
ghka...@gmail.com> a écrit :

Hi,

Does anyone know how I can use the multisearchhttp://www.elasticsearch.org/guide/reference/api/multi-search.htmlfeature using Java API?

I can create a multisearch object but how do I use it to return
MutliSearchResponse?

MultiSearchRequestBuilder multiSearch = new
MultiSearchRequestBuilder(client);
SearchRequestBuilder search =
multiSearch.add(search);

But how do I execute the search and get MultiSearchResponse back?

Any help will be greatly appreciated.

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--

Hi there,
I'm getting the same exception but I'm not using the spring version.
here my code:
MultiSearchRequestBuilder prepareMultiSearch = client.prepareMultiSearch();

for(ContentQuery contentQuery:contentQueryList){

//build the query
CustomScoreQueryBuilder query =
queryBuilder.buildQuery(contentQuery,capiParameters);
SearchRequestBuilder srb=new SearchRequestBuilder(client)
.setIndices(inputParameters.getIndex())
.setTypes(inputParameters.getType())
.setQuery(query);
prepareMultiSearch.add(srb);
}
//execute query
MultiSearchResponse multiSearchOutput =
prepareMultiSearch.execute().actionGet();
...
}
elasticsearch version is:0.19.11
the exception is:
Caused by: org.elasticsearch.transport.TransportSerializationException:
Failed to deserialize response of type
[org.elasticsearch.action.search.MultiSearchResponse]
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:150)
at
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:127)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:458)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:439)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:94)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:390)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:261)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)

any idea?

On Monday, 22 October 2012 19:06:50 UTC+1, hemantp wrote:

Hi David, Sorry i was away for a while. I havent tried it yet. Is there
any recommended os version where i should be trying??

On Wednesday, October 17, 2012 10:41:23 AM UTC-7, David Pilato wrote:

Hi,

Did you try it out ? Does it work now?

David

De : elasti...@googlegroups.com [mailto:elasti...@googlegroups.com] De
la part de
hemantp
Envoyé : mardi 9 octobre 2012 19:34
À : elasti...@googlegroups.com
Cc : David Pilato
Objet : Re: Multisearch Java API

Yes i did clean the class path and made changes to pom as mentioned
above, i also reinstalled Elasticsearch server again (with one node and
one shard and default index configuration) and created new project just
with Elasticsearch dependency but i am still seeing the issue. Just to
make sure that its not related to my machine or OS, i am planning to do
installation on different OS and trying it out (I am currently testing this
on OSX 10.6.8)

On Tuesday, October 9, 2012 1:54:45 AM UTC-7, David Pilato wrote:

Just a question: did you clean your project?

I'm asking this because I can see that I can modify the pom.xml with

org.elasticsearch elasticsearch 0.19.10 fr.pilato.spring spring-elasticsearch 0.0.2

and I get elasticsearch-0.19.10.jar in my classpath. :
https://github.com/scrutmydocs/scrutmydocs/blob/master/pom.xml#L138

I did not test it right now.

Please confirm that it works or not. If not, I will have to make deeper
tests.

David

Le 9 octobre 2012 à 06:04, hemantp hemant.p...@gmail.com a écrit :

I tried doing the maven trick but got the same error:

pom changes:

          <dependency> 

fr.pilato.spring

spring-elasticsearch

0.0.2

org.elasticsearch

elasticsearch

</dependency> 

<dependency> 

org.elasticsearch

elasticsearch

0.19.10

</dependency> 

Any ideas?

On Monday, October 8, 2012 2:03:40 PM UTC-7, David Pilato wrote:

I did not test it but I think that you can modify your pom.xml to ask for
a 0.19.10 version?

If it does not work, it sounds like I have to release a new
spring-elasticsearch version...

Le 8 octobre 2012 à 22:51, hemantp < hemant.p...@gmail.com> a écrit :

Thanks David, yes i am using spring-Elasticsearch integration 0.0.2
which pulls in 0.19.4 version of Elasticsearch whereas the server has
0.19.10 deployed on it. Is there any way to make the response compatible
or should i change the version of Elasticsearch server to 0.19.4? are
there any options to make multi query work?

On Monday, October 8, 2012 11:49:22 AM UTC-7, David Pilato wrote:

You are probably not using the same version of ES on both sides.

--

David :wink:

Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 8 oct. 2012 à 20:44, hemantp < hemant.p...@gmail.com> a écrit :

I tried the code above but i am getting
exception TransportSerializationException. Any hints on what could be the
issue? Below are the details:

Elastic search version: 0.19.10

Code Snippet:

final TransportClient elasticSearchClient = new
TransportClient(elasticSearchSettings());

for (final String elasticSearchNode : elasticSearchNodes) {

elasticSearchClient.addTransportAddress(toAddress(elasticSearchNode));

}

.

.

.

//first query

SearchRequestBuilder srb1 =
elasticSearchClient.prepareSearch().setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery1));

//second query

    SearchRequestBuilder srb2 = 

elasticSearchClient.prepareSearch(index).setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery2));

//doing multi search

elasticSearchClient.prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

Exception:

org.elasticsearch.transport.TransportSerializationException: Failed to
deserialize response of type
[org.elasticsearch.action.search.MultiSearchResponse]

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:390)

    at 

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:261)

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)

    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:680)  

Caused by: java.io.IOException: Expected handle header, got [80]

    at 

org.elasticsearch.common.io.stream.HandlesStreamInput.readUTF(HandlesStreamInput.java:64)

    at 

org.elasticsearch.search.SearchShardTarget.readFrom(SearchShardTarget.java:97)

    at 

org.elasticsearch.search.SearchShardTarget.readSearchShardTarget(SearchShardTarget.java:81)

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.action.search.MultiSearchResponse$Item.readFrom(MultiSearchResponse.java:86)

    at 

org.elasticsearch.action.search.MultiSearchResponse$Item.readItem(MultiSearchResponse.java:78)

    at 

org.elasticsearch.action.search.MultiSearchResponse.readFrom(MultiSearchResponse.java:135)

    at 

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

    ... 22 more 

On Sunday, October 7, 2012 10:19:06 AM UTC-7, bilash wrote:

This worked!

Thanks so much David!

On Saturday, October 6, 2012 3:39:32 AM UTC-4, David Pilato wrote:

Try something like :

SearchRequestBuilder srb1 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your
query here"));

SearchRequestBuilder srb2 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your 2nd
query here"));

MultiSearchResponse sr =
node.client().prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

David

Le 6 octobre 2012 à 08:20, bilash < ghka...@gmail.com> a écrit :

There is not execute method for MultiSearchRequestBuilder that returns a
search response.
Also, there is a no add method that takes MultiSearchRequestBuilder as a
parameter.

On Saturday, October 6, 2012 1:18:24 AM UTC-4, David Pilato wrote:

Looking at code:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

I suppose you can write something like:

client.prepareMultiSearch().add(multisearch).execute().actionGet();https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

HTH

--

David :wink:

Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 oct. 2012 à 04:50, bilash <https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
ghka...@gmail.com> a écrit :

Hi,

Does anyone know how I can use the multisearchhttp://www.elasticsearch.org/guide/reference/api/multi-search.htmlfeature using Java API?

I can create a multisearch object but how do I use it to return
MutliSearchResponse?

MultiSearchRequestBuilder multiSearch = new
MultiSearchRequestBuilder(client);
SearchRequestBuilder search =
multiSearch.add(search);

But how do I execute the search and get MultiSearchResponse back?

Any help will be greatly appreciated.

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--

Hi Tatiana, i wasnt able to find out the solution for the issue. I am
using 0.19.10 version

On Monday, December 17, 2012 7:23:51 AM UTC-8, Tatiana wrote:

Hi there,
I'm getting the same exception but I'm not using the spring version.
here my code:
MultiSearchRequestBuilder prepareMultiSearch = client.prepareMultiSearch();

for(ContentQuery contentQuery:contentQueryList){

//build the query
CustomScoreQueryBuilder query =
queryBuilder.buildQuery(contentQuery,capiParameters);
SearchRequestBuilder srb=new SearchRequestBuilder(client)
.setIndices(inputParameters.getIndex())
.setTypes(inputParameters.getType())
.setQuery(query);
prepareMultiSearch.add(srb);
}
//execute query
MultiSearchResponse multiSearchOutput =
prepareMultiSearch.execute().actionGet();
...
}
elasticsearch version is:0.19.11
the exception is:
Caused by: org.elasticsearch.transport.TransportSerializationException:
Failed to deserialize response of type
[org.elasticsearch.action.search.MultiSearchResponse]
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:150)
at
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:127)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:458)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:439)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:94)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:390)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:261)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)

any idea?

On Monday, 22 October 2012 19:06:50 UTC+1, hemantp wrote:

Hi David, Sorry i was away for a while. I havent tried it yet. Is there
any recommended os version where i should be trying??

On Wednesday, October 17, 2012 10:41:23 AM UTC-7, David Pilato wrote:

Hi,

Did you try it out ? Does it work now?

David

De : elasti...@googlegroups.com [mailto:elasti...@googlegroups.com] De
la part de
hemantp
Envoyé : mardi 9 octobre 2012 19:34
À : elasti...@googlegroups.com
Cc : David Pilato
Objet : Re: Multisearch Java API

Yes i did clean the class path and made changes to pom as mentioned
above, i also reinstalled Elasticsearch server again (with one node and
one shard and default index configuration) and created new project just
with Elasticsearch dependency but i am still seeing the issue. Just to
make sure that its not related to my machine or OS, i am planning to do
installation on different OS and trying it out (I am currently testing this
on OSX 10.6.8)

On Tuesday, October 9, 2012 1:54:45 AM UTC-7, David Pilato wrote:

Just a question: did you clean your project?

I'm asking this because I can see that I can modify the pom.xml with

org.elasticsearch elasticsearch 0.19.10 fr.pilato.spring spring-elasticsearch 0.0.2

and I get elasticsearch-0.19.10.jar in my classpath. :
https://github.com/scrutmydocs/scrutmydocs/blob/master/pom.xml#L138

I did not test it right now.

Please confirm that it works or not. If not, I will have to make deeper
tests.

David

Le 9 octobre 2012 à 06:04, hemantp hemant.p...@gmail.com a écrit :

I tried doing the maven trick but got the same error:

pom changes:

          <dependency> 

fr.pilato.spring

spring-elasticsearch

0.0.2

org.elasticsearch

elasticsearch

</dependency> 

<dependency> 

org.elasticsearch

elasticsearch

0.19.10

</dependency> 

Any ideas?

On Monday, October 8, 2012 2:03:40 PM UTC-7, David Pilato wrote:

I did not test it but I think that you can modify your pom.xml to ask
for a 0.19.10 version?

If it does not work, it sounds like I have to release a new
spring-elasticsearch version...

Le 8 octobre 2012 à 22:51, hemantp < hemant.p...@gmail.com> a écrit :

Thanks David, yes i am using spring-Elasticsearch integration 0.0.2
which pulls in 0.19.4 version of Elasticsearch whereas the server has
0.19.10 deployed on it. Is there any way to make the response compatible
or should i change the version of Elasticsearch server to 0.19.4? are
there any options to make multi query work?

On Monday, October 8, 2012 11:49:22 AM UTC-7, David Pilato wrote:

You are probably not using the same version of ES on both sides.

--

David :wink:

Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 8 oct. 2012 à 20:44, hemantp < hemant.p...@gmail.com> a écrit :

I tried the code above but i am getting
exception TransportSerializationException. Any hints on what could be the
issue? Below are the details:

Elastic search version: 0.19.10

Code Snippet:

final TransportClient elasticSearchClient = new
TransportClient(elasticSearchSettings());

for (final String elasticSearchNode : elasticSearchNodes) {

elasticSearchClient.addTransportAddress(toAddress(elasticSearchNode));

}

.

.

.

//first query

SearchRequestBuilder srb1 =
elasticSearchClient.prepareSearch().setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery1));

//second query

    SearchRequestBuilder srb2 = 

elasticSearchClient.prepareSearch(index).setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery2));

//doing multi search

elasticSearchClient.prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

Exception:

org.elasticsearch.transport.TransportSerializationException: Failed to
deserialize response of type
[org.elasticsearch.action.search.MultiSearchResponse]

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:390)

    at 

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:261)

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)

    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:680)  

Caused by: java.io.IOException: Expected handle header, got [80]

    at 

org.elasticsearch.common.io.stream.HandlesStreamInput.readUTF(HandlesStreamInput.java:64)

    at 

org.elasticsearch.search.SearchShardTarget.readFrom(SearchShardTarget.java:97)

    at 

org.elasticsearch.search.SearchShardTarget.readSearchShardTarget(SearchShardTarget.java:81)

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.action.search.MultiSearchResponse$Item.readFrom(MultiSearchResponse.java:86)

    at 

org.elasticsearch.action.search.MultiSearchResponse$Item.readItem(MultiSearchResponse.java:78)

    at 

org.elasticsearch.action.search.MultiSearchResponse.readFrom(MultiSearchResponse.java:135)

    at 

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

    ... 22 more 

On Sunday, October 7, 2012 10:19:06 AM UTC-7, bilash wrote:

This worked!

Thanks so much David!

On Saturday, October 6, 2012 3:39:32 AM UTC-4, David Pilato wrote:

Try something like :

SearchRequestBuilder srb1 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your
query here"));

SearchRequestBuilder srb2 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your 2nd
query here"));

MultiSearchResponse sr =
node.client().prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

David

Le 6 octobre 2012 à 08:20, bilash < ghka...@gmail.com> a écrit :

There is not execute method for MultiSearchRequestBuilder that returns a
search response.
Also, there is a no add method that takes MultiSearchRequestBuilder as
a parameter.

On Saturday, October 6, 2012 1:18:24 AM UTC-4, David Pilato wrote:

Looking at code:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

I suppose you can write something like:

client.prepareMultiSearch().add(multisearch).execute().actionGet();https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

HTH

--

David :wink:

Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 oct. 2012 à 04:50, bilash <https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
ghka...@gmail.com> a écrit :

Hi,

Does anyone know how I can use the multisearchhttp://www.elasticsearch.org/guide/reference/api/multi-search.htmlfeature using Java API?

I can create a multisearch object but how do I use it to return
MutliSearchResponse?

MultiSearchRequestBuilder multiSearch = new
MultiSearchRequestBuilder(client);
SearchRequestBuilder search =
multiSearch.add(search);

But how do I execute the search and get MultiSearchResponse back?

Any help will be greatly appreciated.

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--

Hi,

Thís bellow is sample of MSR:
MultiSearchRequestBuilder msrb = new MultiSearchRequestBuilder(_cli);

        for (int i = 0; i < n; ++i) {
            SearchRequestBuilder srb = 

_cli.prepareSearch(m_strIndexName)
.addField(FIELD_NAME)
.setQuery(strQuery)
.setTypes(types[i]);
msrb.add(srb);
}

        MultiSearchResponse msrsp = msrb.execute().actionGet();
        Item[] responses = msrsp.getResponses();

The Item[] is list of result back for each srb.
You could get it ás SRB: SearchHits hits =
responses[i].getResponse().getHits();

Hope it help.

--

Hi Tatiana,

Check elasticsearch log file. Most likely reason for this error is failure
to parse your query (it might be missing script field, for example). The
error in elasticsearch log might contain more useful information about the
actual cause of this issue.

Igor

On Monday, December 17, 2012 10:23:51 AM UTC-5, Tatiana wrote:

Hi there,
I'm getting the same exception but I'm not using the spring version.
here my code:
MultiSearchRequestBuilder prepareMultiSearch = client.prepareMultiSearch();

for(ContentQuery contentQuery:contentQueryList){

//build the query
CustomScoreQueryBuilder query =
queryBuilder.buildQuery(contentQuery,capiParameters);
SearchRequestBuilder srb=new SearchRequestBuilder(client)
.setIndices(inputParameters.getIndex())
.setTypes(inputParameters.getType())
.setQuery(query);
prepareMultiSearch.add(srb);
}
//execute query
MultiSearchResponse multiSearchOutput =
prepareMultiSearch.execute().actionGet();
...
}
elasticsearch version is:0.19.11
the exception is:
Caused by: org.elasticsearch.transport.TransportSerializationException:
Failed to deserialize response of type
[org.elasticsearch.action.search.MultiSearchResponse]
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:150)
at
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:127)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:458)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:439)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:94)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:390)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:261)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)

any idea?

On Monday, 22 October 2012 19:06:50 UTC+1, hemantp wrote:

Hi David, Sorry i was away for a while. I havent tried it yet. Is there
any recommended os version where i should be trying??

On Wednesday, October 17, 2012 10:41:23 AM UTC-7, David Pilato wrote:

Hi,

Did you try it out ? Does it work now?

David

De : elasti...@googlegroups.com [mailto:elasti...@googlegroups.com] De
la part de
hemantp
Envoyé : mardi 9 octobre 2012 19:34
À : elasti...@googlegroups.com
Cc : David Pilato
Objet : Re: Multisearch Java API

Yes i did clean the class path and made changes to pom as mentioned
above, i also reinstalled Elasticsearch server again (with one node and
one shard and default index configuration) and created new project just
with Elasticsearch dependency but i am still seeing the issue. Just to
make sure that its not related to my machine or OS, i am planning to do
installation on different OS and trying it out (I am currently testing this
on OSX 10.6.8)

On Tuesday, October 9, 2012 1:54:45 AM UTC-7, David Pilato wrote:

Just a question: did you clean your project?

I'm asking this because I can see that I can modify the pom.xml with

org.elasticsearch elasticsearch 0.19.10 fr.pilato.spring spring-elasticsearch 0.0.2

and I get elasticsearch-0.19.10.jar in my classpath. :
https://github.com/scrutmydocs/scrutmydocs/blob/master/pom.xml#L138

I did not test it right now.

Please confirm that it works or not. If not, I will have to make deeper
tests.

David

Le 9 octobre 2012 à 06:04, hemantp hemant.p...@gmail.com a écrit :

I tried doing the maven trick but got the same error:

pom changes:

          <dependency> 

fr.pilato.spring

spring-elasticsearch

0.0.2

org.elasticsearch

elasticsearch

</dependency> 

<dependency> 

org.elasticsearch

elasticsearch

0.19.10

</dependency> 

Any ideas?

On Monday, October 8, 2012 2:03:40 PM UTC-7, David Pilato wrote:

I did not test it but I think that you can modify your pom.xml to ask
for a 0.19.10 version?

If it does not work, it sounds like I have to release a new
spring-elasticsearch version...

Le 8 octobre 2012 à 22:51, hemantp < hemant.p...@gmail.com> a écrit :

Thanks David, yes i am using spring-Elasticsearch integration 0.0.2
which pulls in 0.19.4 version of Elasticsearch whereas the server has
0.19.10 deployed on it. Is there any way to make the response compatible
or should i change the version of Elasticsearch server to 0.19.4? are
there any options to make multi query work?

On Monday, October 8, 2012 11:49:22 AM UTC-7, David Pilato wrote:

You are probably not using the same version of ES on both sides.

--

David :wink:

Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 8 oct. 2012 à 20:44, hemantp < hemant.p...@gmail.com> a écrit :

I tried the code above but i am getting
exception TransportSerializationException. Any hints on what could be the
issue? Below are the details:

Elastic search version: 0.19.10

Code Snippet:

final TransportClient elasticSearchClient = new
TransportClient(elasticSearchSettings());

for (final String elasticSearchNode : elasticSearchNodes) {

elasticSearchClient.addTransportAddress(toAddress(elasticSearchNode));

}

.

.

.

//first query

SearchRequestBuilder srb1 =
elasticSearchClient.prepareSearch().setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery1));

//second query

    SearchRequestBuilder srb2 = 

elasticSearchClient.prepareSearch(index).setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery2));

//doing multi search

elasticSearchClient.prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

Exception:

org.elasticsearch.transport.TransportSerializationException: Failed to
deserialize response of type
[org.elasticsearch.action.search.MultiSearchResponse]

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:390)

    at 

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:261)

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)

    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:680)  

Caused by: java.io.IOException: Expected handle header, got [80]

    at 

org.elasticsearch.common.io.stream.HandlesStreamInput.readUTF(HandlesStreamInput.java:64)

    at 

org.elasticsearch.search.SearchShardTarget.readFrom(SearchShardTarget.java:97)

    at 

org.elasticsearch.search.SearchShardTarget.readSearchShardTarget(SearchShardTarget.java:81)

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.action.search.MultiSearchResponse$Item.readFrom(MultiSearchResponse.java:86)

    at 

org.elasticsearch.action.search.MultiSearchResponse$Item.readItem(MultiSearchResponse.java:78)

    at 

org.elasticsearch.action.search.MultiSearchResponse.readFrom(MultiSearchResponse.java:135)

    at 

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

    ... 22 more 

On Sunday, October 7, 2012 10:19:06 AM UTC-7, bilash wrote:

This worked!

Thanks so much David!

On Saturday, October 6, 2012 3:39:32 AM UTC-4, David Pilato wrote:

Try something like :

SearchRequestBuilder srb1 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your
query here"));

SearchRequestBuilder srb2 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your 2nd
query here"));

MultiSearchResponse sr =
node.client().prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

David

Le 6 octobre 2012 à 08:20, bilash < ghka...@gmail.com> a écrit :

There is not execute method for MultiSearchRequestBuilder that returns a
search response.
Also, there is a no add method that takes MultiSearchRequestBuilder as
a parameter.

On Saturday, October 6, 2012 1:18:24 AM UTC-4, David Pilato wrote:

Looking at code:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

I suppose you can write something like:

client.prepareMultiSearch().add(multisearch).execute().actionGet();https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

HTH

--

David :wink:

Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 oct. 2012 à 04:50, bilash <https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
ghka...@gmail.com> a écrit :

Hi,

Does anyone know how I can use the multisearchhttp://www.elasticsearch.org/guide/reference/api/multi-search.htmlfeature using Java API?

I can create a multisearch object but how do I use it to return
MutliSearchResponse?

MultiSearchRequestBuilder multiSearch = new
MultiSearchRequestBuilder(client);
SearchRequestBuilder search =
multiSearch.add(search);

But how do I execute the search and get MultiSearchResponse back?

Any help will be greatly appreciated.

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--

I created an issue in github
Search failures are not serialized correctly in MultiSearchResponse · Issue #2498 · elastic/elasticsearch · GitHub to track this
problem.

On Thursday, December 20, 2012 10:49:36 AM UTC-5, Igor Motov wrote:

Hi Tatiana,

Check elasticsearch log file. Most likely reason for this error is failure
to parse your query (it might be missing script field, for example). The
error in elasticsearch log might contain more useful information about the
actual cause of this issue.

Igor

On Monday, December 17, 2012 10:23:51 AM UTC-5, Tatiana wrote:

Hi there,
I'm getting the same exception but I'm not using the spring version.
here my code:
MultiSearchRequestBuilder prepareMultiSearch =
client.prepareMultiSearch();

for(ContentQuery contentQuery:contentQueryList){

//build the query
CustomScoreQueryBuilder query =
queryBuilder.buildQuery(contentQuery,capiParameters);
SearchRequestBuilder srb=new SearchRequestBuilder(client)
.setIndices(inputParameters.getIndex())
.setTypes(inputParameters.getType())
.setQuery(query);
prepareMultiSearch.add(srb);
}
//execute query
MultiSearchResponse multiSearchOutput =
prepareMultiSearch.execute().actionGet();
...
}
elasticsearch version is:0.19.11
the exception is:
Caused by: org.elasticsearch.transport.TransportSerializationException:
Failed to deserialize response of type
[org.elasticsearch.action.search.MultiSearchResponse]
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:150)
at
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:127)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:458)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:439)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:94)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:390)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:261)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)

any idea?

On Monday, 22 October 2012 19:06:50 UTC+1, hemantp wrote:

Hi David, Sorry i was away for a while. I havent tried it yet. Is
there any recommended os version where i should be trying??

On Wednesday, October 17, 2012 10:41:23 AM UTC-7, David Pilato wrote:

Hi,

Did you try it out ? Does it work now?

David

De : elasti...@googlegroups.com [mailto:elasti...@googlegroups.com] De
la part de
hemantp
Envoyé : mardi 9 octobre 2012 19:34
À : elasti...@googlegroups.com
Cc : David Pilato
Objet : Re: Multisearch Java API

Yes i did clean the class path and made changes to pom as mentioned
above, i also reinstalled Elasticsearch server again (with one node and
one shard and default index configuration) and created new project just
with Elasticsearch dependency but i am still seeing the issue. Just to
make sure that its not related to my machine or OS, i am planning to do
installation on different OS and trying it out (I am currently testing this
on OSX 10.6.8)

On Tuesday, October 9, 2012 1:54:45 AM UTC-7, David Pilato wrote:

Just a question: did you clean your project?

I'm asking this because I can see that I can modify the pom.xml with

org.elasticsearch elasticsearch 0.19.10 fr.pilato.spring spring-elasticsearch 0.0.2

and I get elasticsearch-0.19.10.jar in my classpath. :
https://github.com/scrutmydocs/scrutmydocs/blob/master/pom.xml#L138

I did not test it right now.

Please confirm that it works or not. If not, I will have to make deeper
tests.

David

Le 9 octobre 2012 à 06:04, hemantp hemant.p...@gmail.com a écrit :

I tried doing the maven trick but got the same error:

pom changes:

          <dependency> 

fr.pilato.spring

spring-elasticsearch

0.0.2

org.elasticsearch

elasticsearch

</dependency> 

<dependency> 

org.elasticsearch

elasticsearch

0.19.10

</dependency> 

Any ideas?

On Monday, October 8, 2012 2:03:40 PM UTC-7, David Pilato wrote:

I did not test it but I think that you can modify your pom.xml to ask
for a 0.19.10 version?

If it does not work, it sounds like I have to release a new
spring-elasticsearch version...

Le 8 octobre 2012 à 22:51, hemantp < hemant.p...@gmail.com> a écrit :

Thanks David, yes i am using spring-Elasticsearch integration 0.0.2
which pulls in 0.19.4 version of Elasticsearch whereas the server has
0.19.10 deployed on it. Is there any way to make the response compatible
or should i change the version of Elasticsearch server to 0.19.4? are
there any options to make multi query work?

On Monday, October 8, 2012 11:49:22 AM UTC-7, David Pilato wrote:

You are probably not using the same version of ES on both sides.

--

David :wink:

Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 8 oct. 2012 à 20:44, hemantp < hemant.p...@gmail.com> a écrit :

I tried the code above but i am getting
exception TransportSerializationException. Any hints on what could be the
issue? Below are the details:

Elastic search version: 0.19.10

Code Snippet:

final TransportClient elasticSearchClient = new
TransportClient(elasticSearchSettings());

for (final String elasticSearchNode : elasticSearchNodes) {

elasticSearchClient.addTransportAddress(toAddress(elasticSearchNode));

}

.

.

.

//first query

SearchRequestBuilder srb1 =
elasticSearchClient.prepareSearch().setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery1));

//second query

    SearchRequestBuilder srb2 = 

elasticSearchClient.prepareSearch(index).setTypes(recordType)

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(QueryBuilders.queryString(myQuery2));

//doing multi search

elasticSearchClient.prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

Exception:

org.elasticsearch.transport.TransportSerializationException: Failed to
deserialize response of type
[org.elasticsearch.action.search.MultiSearchResponse]

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:390)

    at 

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:261)

    at 

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

    at 

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

    at 

org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)

    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:680)  

Caused by: java.io.IOException: Expected handle header, got [80]

    at 

org.elasticsearch.common.io.stream.HandlesStreamInput.readUTF(HandlesStreamInput.java:64)

    at 

org.elasticsearch.search.SearchShardTarget.readFrom(SearchShardTarget.java:97)

    at 

org.elasticsearch.search.SearchShardTarget.readSearchShardTarget(SearchShardTarget.java:81)

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

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

    at 

org.elasticsearch.action.search.MultiSearchResponse$Item.readFrom(MultiSearchResponse.java:86)

    at 

org.elasticsearch.action.search.MultiSearchResponse$Item.readItem(MultiSearchResponse.java:78)

    at 

org.elasticsearch.action.search.MultiSearchResponse.readFrom(MultiSearchResponse.java:135)

    at 

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

    ... 22 more 

On Sunday, October 7, 2012 10:19:06 AM UTC-7, bilash wrote:

This worked!

Thanks so much David!

On Saturday, October 6, 2012 3:39:32 AM UTC-4, David Pilato wrote:

Try something like :

SearchRequestBuilder srb1 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your
query here"));

SearchRequestBuilder srb2 =
node.client().prepareSearch().setQuery(QueryBuilders.queryString("your 2nd
query here"));

MultiSearchResponse sr =
node.client().prepareMultiSearch().add(srb1).add(srb2).execute().actionGet();

David

Le 6 octobre 2012 à 08:20, bilash < ghka...@gmail.com> a écrit :

There is not execute method for MultiSearchRequestBuilder that returns
a search response.
Also, there is a no add method that takes MultiSearchRequestBuilder as
a parameter.

On Saturday, October 6, 2012 1:18:24 AM UTC-4, David Pilato wrote:

Looking at code:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

I suppose you can write something like:

client.prepareMultiSearch().add(multisearch).execute().actionGet();https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393

HTH

--

David :wink:

Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 oct. 2012 à 04:50, bilash <https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/client/Client.java#L393
ghka...@gmail.com> a écrit :

Hi,

Does anyone know how I can use the multisearchhttp://www.elasticsearch.org/guide/reference/api/multi-search.htmlfeature using Java API?

I can create a multisearch object but how do I use it to return
MutliSearchResponse?

MultiSearchRequestBuilder multiSearch = new
MultiSearchRequestBuilder(client);
SearchRequestBuilder search =
multiSearch.add(search);

But how do I execute the search and get MultiSearchResponse back?

Any help will be greatly appreciated.

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--