Have to tried matchQuery instead of termQuery?

Jörg


On Tue, Mar 25, 2014 at 1:19 PM, Subhadip Bagui <i.ba...@gmail.com> wrote:

> Hi,
>
> I'm using the below method to get results from ES. But search hit result
> is 0. Please let me know the correct way to get results,
>
>   public static SearchResponse searchIndex(Client client, Node node)
>   {
>   SearchRequestBuilder srequest =
> client.prepareSearch("testindex").setTypes("testtype")
>    .setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
>    .setQuery(QueryBuilders.termQuery("author", "shay"))
>    .setSize(1);
>   SearchResponse sresp = srequest.execute().actionGet();
>   return sresp;
>   }
>
> data ==>
>
>    - "_source":{
>       - "tags":[
>          - "elasticsearch"
>       ],
>       - "content":"ElasticSearch provides the Java API",
>       - "author":"Shay Banon",
>       - "title":"ElasticSearch: Java API",
>       - "postDate":"2014-03-21T09:32:34.782Z"
>    }
>
>
> Thanks,
> Subhadip
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/293d28fb-5aaa-40cf-a77a-c7966c37536d%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/293d28fb-5aaa-40cf-a77a-c7966c37536d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGCGGk6dG%3Dbps0Bg7hYktt0E%3DCio44Ga2BeVwmL-c-guQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to