How to pass type in preparesearch java api?

hi,
i want to not only pass the index name but also the type to preparesearch
java api. i couldn't figure out how to do it. can someone help?

i have indexed my documents using a index name, type and id. now i want to
search and restrict the results to a given type.

thanks

prepareSearch(...) returns a SearchRequestBuilder, which itself has a
setTypes(...) method which takes a String vararg as a parameter.

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/action/search/SearchRequestBuilder.java#L63

eg:
SearchRequestBuilder searchBuilder =
client.prepareSearch("my_index").setTypes("my_type");

--
Ivan

On Thu, Feb 16, 2012 at 7:49 AM, T Vinod Gupta tvinod@readypulse.com wrote:

hi,
i want to not only pass the index name but also the type to preparesearch
java api. i couldn't figure out how to do it. can someone help?

i have indexed my documents using a index name, type and id. now i want to
search and restrict the results to a given type.

thanks

thanks ivan.. i saw that after sending the mail!

On Thu, Feb 16, 2012 at 9:17 AM, Ivan Brusic ivan@brusic.com wrote:

prepareSearch(...) returns a SearchRequestBuilder, which itself has a
setTypes(...) method which takes a String vararg as a parameter.

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/action/search/SearchRequestBuilder.java#L63

eg:
SearchRequestBuilder searchBuilder =
client.prepareSearch("my_index").setTypes("my_type");

--
Ivan

On Thu, Feb 16, 2012 at 7:49 AM, T Vinod Gupta tvinod@readypulse.com
wrote:

hi,
i want to not only pass the index name but also the type to preparesearch
java api. i couldn't figure out how to do it. can someone help?

i have indexed my documents using a index name, type and id. now i want
to
search and restrict the results to a given type.

thanks