Searching using JAVA and REST APIs


(Algoncalves) #1

Hi All,

Please, could you provide a simple search example integrating JAVA and REST APIs.
I´ve tried the below example but it failures.

String queryString = "{" +
""query" : { " +
" "term" : { " +
" "message" : "test" " +
"}}}";

SearchRequestBuilder srb = client.prepareSearch(indexName).
setSearchType(SearchType.QUERY_AND_FETCH).
setQuery(queryString);

Thanks,

Alex


(system) #2