Skip to content

Latest commit

 

History

History
15 lines (10 loc) · 396 Bytes

File metadata and controls

15 lines (10 loc) · 396 Bytes

Terminate After

获取文档的最大数量,如果设置了,需要通过SearchResponse对象里的isTerminatedEarly() 判断返回文档是否达到设置的数量:

SearchResponse sr = client.prepareSearch(INDEX)
    .setTerminateAfter(1000)    //如果达到这个数量,提前终止
    .get();

if (sr.isTerminatedEarly()) {
    // We finished early
}