Multi search API with multi indexes

Hi I'm trying to run a multi request using the java api.
I have 2 queries which I would like to run them both on 2 different indexes. the problem is that apparently I'm unable to direct queries to different indexes as the multi search api suggests here:
http://www.elasticsearch.org/guide/reference/api/multi-search/

When trying to run the queries I actually get result for query running the search on both indexes together...

when I use client.prepareSearch("index1", "index2") it just makes the queries search both indexes at the same time, resulting in getting overload of results.

Also tried putting putHeader("index", "index1") for the request before adding the request to the multi object, but it looks like it ignores it.

did any one ever add this problem before?

Thanks in advanced,

Oren

Hi,
can you try client.prepareMultiSearch().add(...) and see if this is what
you want ?

Greetings Christian

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Thanks! that did the trick!

I'm not sure what's the difference between creating the multi object as:
MultiSearchRequestBuilder multi =new
MultiSearchRequestBuilder(ProfileReportRequestHandler.getClient());
or as:
MultiSearchRequestBuilder multi =
ProfileReportRequestHandler.getClient().prepareMultiSearch();

but only the second one executed the requests to the exact index that I
specified on request creation.

thanks again.

On Mon, Jul 29, 2013 at 1:34 PM, Christian Th. [via Elasticsearch Users] <
ml-node+s115913n4038803h28@n3.nabble.com> wrote:

Hi,
can you try client.prepareMultiSearch().add(...) and see if this is what
you want ?

Greetings Christian

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [hidden email]http://user/SendEmail.jtp?type=node&node=4038803&i=0
.
For more options, visit https://groups.google.com/groups/opt_out.


If you reply to this email, your message will be added to the discussion
below:

http://elasticsearch-users.115913.n3.nabble.com/Multi-search-API-with-multi-indexes-tp4038799p4038803.html
To unsubscribe from Multi search API with multi indexes, click herehttp://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4038799&code=b3Jlbm9AZXhlbGF0ZS5jb218NDAzODc5OXw4ODk1Mjk2Nzg=
.
NAMLhttp://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html!nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers!nabble%3Aemail.naml-instant_emails!nabble%3Aemail.naml-send_instant_email!nabble%3Aemail.naml

signature.bmp (1M) http://elasticsearch-users.115913.n3.nabble.com/attachment/4038811/0/signature.bmp