panic with "thread 'main' panicked at 'not currently running on the Tokio runtime

It looks like Elasticsearch's crate is using Tokio internally, so you must use it too to match their assumptions.

Looking for block_on function in their documentation, I've got this. So, it appears that your main should look like this:

use tokio::runtime::Runtime;

fn main() {
        .expect("Failed to create Tokio runtime")

Or you can make you main function itself async with the attribute macro, which will generate runtime creation and block_on call for you:

async fn main() {

I had the same error when I used to tokio::run (from tokio version = 0.1) with crate that use tokio02 (tokio version = 0.2) internally (in my case it was reqwest). First I just changed std::future::Future to futures01::future::Future with futures03::compat. To make it compile. After run I get exactly your error.


Adding tokio-compat resolved my problem.

More about tokio compat