Hi Buddy,
In my project, included spring boot(2.0.4) + spring data+ elasticsearch.client(transport:5.6.10).
when i try to used elasticsearchTemplate query object list, its return size=0, and no errors or exception.
QueryBuilder query = QueryBuilders.boolQuery().must(QueryBuilders.boolQuery().mustNot(QueryBuilders.termQuery(Constants.VIN, StringUtils.EMPTY))
.must(QueryBuilders.matchPhraseQuery(Constants.MESSAGE_CONTENT, Constants.RA_MESSAGE_SUCESS))
.filter(QueryBuilders.rangeQuery(Constants.LOG_TIME).gte("2018-08-13 13:47:00").lte("2018-08-13 13:47:59")));
name.setName(currentIndexName);
SearchQuery searchQuery = new NativeSearchQueryBuilder().withIndices(currentIndexName).withTypes("log").withQuery(query).build();
System.out.println(searchQuery.getQuery());
List<LoggerProperty> list = elasticsearchTemplate.queryForList(searchQuery, LoggerProperty.class);
Meanwhile, i pasted the console output DSL(XXXX), and add "query": { XXXX } , it work well in postman.
Is there anybody can help me to clearify the problem, thanks in advance!