@query elasticsearch弹出数据以获得最大ID

时间:2016-01-07 15:19:12

标签: elasticsearch spring-data-elasticsearch

我试图通过@query elasticsearch spring数据获取max和min id,所以我使用以下代码但是我得到了错误 没有为[aggs]]注册查询;

@Query(value="{\"aggs\":{\"max_id\":{\"max\":{\"field\":\"id\"}}}}")
Segment findMaxId();

堆栈跟踪

org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to
execute phase [dfs], all shards failed; shardFailures  
{[QvVc1wxqRoWtkUhGSDULCg][segment][0]: SearchParseException[[segment][0]:
from[0],size[10]: Parse Failure [Failed to parse source
[{"from":0,"size":10,"query_binary":
     "eyJhZ2dzIjp7Im1heF9pZCI6eyJtYXgiOnsiZmllb
GQiOiJpZCJ9fX19"}]]]; nested: QueryParsingException[[segment] No query
registered for [aggs]]; }{[QvVc1wxqRoWtkUhGSDULCg][segment][1]:
SearchParseException[[segment][1]: from[0],size[10]: Parse Failure 
[Failed to parse source [{"from":0,"size":10,"query_binary":
"eyJhZ2dzIjp7Im1heF9pZCI6eyJtYXgiOnsiZmllbGQiOiJpZCJ9fX19"}]]]; nested:
QueryParsingException[[segment] No query registered for [aggs]];
 }{[QvVc1wxqRoWtkUhGSDULCg][segment][2]:
 SearchParseException[[segment][2]: from[0],size[10]: Parse Failure 
   [Failed to parse source 

0 个答案:

没有答案