Java high level client 7.10 shard successful 0 when took > 1000

Hi
I'm using java high level client to execute aggregation。 when the took in response gt 1000,it give a wrong result like below( it always ok when i do it in kibana):

{
  "took": 1002,
  "timed_out": false,
  "terminated_early": false,
  "num_reduce_phases": 0,
  "_shards": {
    "total": 20,
    "successful": 0,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 0,
      "relation": "gte"
    },
    "max_score": null,
    "hits": 
  }
}

and when i redo the search,it may success or not .it success like below(it's took less than 1000)

{
  "took" : 231,
  "timed_out" : false,
  "_shards" : {
    "total" : 20,
    "successful" : 20,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : null,
    "hits" : [ ]
  },
  "aggregations" : {
    "term0" : {
      "doc_count" : 8526098,
      "countCOUNT_DISTINCTdid" : {
        "value" : 3929368
      }
    }
  }
}

It looks like failfast.Why is this and how to solve it.