You can pass a search “timeout” in the request body or in the uri request. If the search request times out before collecting all results, the partial results will be returned.
Here’s a uri request example for 10 seconds (units are in milliseconds):
http://localhost:9200/_search?timeout=10000
If you set the timeout low enough, the returned json will show “timed_out”:true.