Enabling Future Mode

edit

The client supports asynchronous, batch processing of requests. This is enabled (if your HTTP handler supports it) on a per-request basis via the future parameter in the client options:

$client = ClientBuilder::create()->build();

$params = [
    'index' => 'test',
    'type' => 'test',
    'id' => 1,
    'client' => [
        'future' => 'lazy'
    ]
];
$future = $client->get($params);
$results = $future->wait();       // resolve the future

Future mode supports two options: true or lazy. For more details about how asynchronous execution functions, and how to work with the results, see the dedicated page on Future Mode.