hi, I have a code like below
public List<String>compoundSearch()
{
compoundsearch = new ArrayList<>();
client.admin().indices().prepareRefresh("logstash-*");
QueryBuilder queryBuilder = boolQuery()
.must(QueryBuilders.termQuery("device", "Device5"))
.must(QueryBuilders.termQuery("gateway", "GTW1"));
SearchRequestBuilder searchRequestBuilder = client.prepareSearch("logstash-*");
searchRequestBuilder.setQuery(queryBuilder);
SearchResponse response = searchRequestBuilder.execute().actionGet();
System.out.println(response.contextSize());
for (SearchHit hit : response.getHits()){
compoundsearch.add(hit.getSourceAsString());
}
return compoundsearch;
}
when i execute it , the response returned a null value . what is the problem ?