Repository: elastic-rs/elastic (language: rust)

Issue:
Bump Hyper Version
Hey, I just updated to openssl 1.1.1 and it appears that hyper 10 uses rust openssl 0.9.24 which does not support openssl 1.1.1. Would you be able to bump hyper so that the new ssl version is supported?


Discussion / hints:

Fix patch:
diff --git a/ci/nightly.sh b/ci/nightly.sh
index e9d53df586..541620ed42 100755
--- a/ci/nightly.sh
+++ b/ci/nightly.sh
@@ -25,10 +25,6 @@ if [ "$KIND" == "build" ]; then
         echo "Pushing gh-pages to GitHub"
         git push -q upstream HEAD:refs/heads/gh-pages --force
     fi
-elif [ "$KIND" == "integration" ]; then 
-    cd tests/run
-    cargo build
-
-    export RUST_LOG=info
-    ../../target/debug/run default sniffed_node
+elif [ "$KIND" == "integration" ]; then
+    ELASTIC_LOG=info cargo run -p integration_tests -- default sniffed_node
 fi
diff --git a/examples/account_sample/src/main.rs b/examples/account_sample/src/main.rs
index fd55e33905..e67603975e 100644
--- a/examples/account_sample/src/main.rs
+++ b/examples/account_sample/src/main.rs
@@ -16,10 +16,13 @@ extern crate serde_json;
 pub mod model;
 pub mod ops;
 
-use std::error::Error;
-use ops::Client;
-use ops::commands::{EnsureBankIndexExists, PutBulkAccounts};
+use ops::commands::{
+    EnsureBankIndexExists,
+    PutBulkAccounts,
+};
 use ops::queries::SimpleSearchQuery;
+use ops::Client;
+use std::error::Error;
 
 fn run() -> Result<(), Box<Error>> {
     let client = Client::new("http://localhost:9200")?;
diff --git a/examples/account_sample/src/model/account.rs b/examples/account_sample/src/model/account.rs
index 89efd363f2..d2e78f2b7e 100644
--- a/examples/account_sample/src/model/account.rs
+++ b/examples/account_sample/src/model/account.rs
@@ -52,8 +52,10 @@ pub type State = Keyword<DefaultKeywordMapping>;
 
 #[derive(Debug, Serialize, Deserialize)]
 pub enum Gender {
-    #[serde(rename = "F")] Female,
-    #[serde(rename = "M")] Male,
+    #[serde(rename = "F")]
+    Female,
+    #[serde(rename = "M")]
+    Male,
 }
 
 impl KeywordFieldType<DefaultKeywordMapping> for Gender {}
@@ -73,9 +75,9 @@ impl TextMapping for EmailMapping {
 
 #[cfg(test)]
 mod tests {
-    use serde_json;
-    use elastic::types::prelude::DocumentType;
     use super::*;
+    use elastic::types::prelude::DocumentType;
+    use serde_json;
 
     #[test]
     fn deserialize() {
diff --git a/examples/account_sample/src/model/index.rs b/examples/account_sample/src/model/index.rs
index 36e124aef3..93e09f026d 100644
--- a/examples/account_sample/src/model/index.rs
+++ b/examples/account_sample/src/model/index.rs
@@ -4,9 +4,9 @@
 //! for checking whether the bank index exists and creating it along with
 //! analysers, filters and mapping for `Account`s.
 
-use serde_json::Value;
-use elastic::prelude::*;
 use super::account::Account;
+use elastic::prelude::*;
+use serde_json::Value;
 
 /// Get the name of the bank index.
 pub fn name() -> Index<'static> {
diff --git a/examples/account_sample/src/model/mod.rs b/examples/account_sample/src/model/mod.rs
index 521d5dcf98..f9d7ec6c0f 100644
--- a/examples/account_sample/src/model/mod.rs
+++ b/examples/account_sample/src/model/mod.rs
@@ -3,5 +3,5 @@
 //! This module contains the models, commands and queries for
 //! interacting with our Elasticsearch datastore.
 
-pub mod index;
 pub mod account;
+pub mod index;
diff --git a/examples/account_sample/src/ops/commands/ensure_bank_index_exists.rs b/examples/account_sample/src/ops/commands/ensure_bank_index_exists.rs
index c303fe87fa..bb6b23af6b 100644
--- a/examples/account_sample/src/ops/commands/ensure_bank_index_exists.rs
+++ b/examples/account_sample/src/ops/commands/ensure_bank_index_exists.rs
@@ -1,9 +1,9 @@
-use ops::Client;
-use std::io::Error as IoError;
-use serde_json::Error as JsonError;
+use elastic::http::StatusCode;
 use elastic::prelude::*;
 use elastic::Error as ResponseError;
-use elastic::http::StatusCode;
+use ops::Client;
+use serde_json::Error as JsonError;
+use std::io::Error as IoError;
 
 use model;
 
@@ -13,7 +13,8 @@ pub trait EnsureBankIndexExists {
 
 impl EnsureBankIndexExists for Client {
     fn ensure_bank_index_exists(&self) -> Result<(), EnsureBankIndexExistsError> {
-        let exists = self.io
+        let exists = self
+            .io
             .request(IndicesExistsRequest::for_index(model::index::name()))
             .send()?;
 
@@ -38,7 +39,7 @@ impl EnsureBankIndexExists for Client {
     }
 }
 
-quick_error!{
+quick_error! {
     #[derive(Debug)]
     pub enum EnsureBankIndexExistsError {
         Io(err: IoError) {
diff --git a/examples/account_sample/src/ops/commands/put_bulk_accounts.rs b/examples/account_sample/src/ops/commands/put_bulk_accounts.rs
index f9467762c7..aa299a5003 100644
--- a/examples/account_sample/src/ops/commands/put_bulk_accounts.rs
+++ b/examples/account_sample/src/ops/commands/put_bulk_accounts.rs
@@ -1,11 +1,17 @@
-use std::io::{Error as IoError, Result as IoResult};
-use std::fs::File;
-use std::path::Path;
-use ops::Client;
-use elastic::prelude::*;
-use elastic::client::responses::bulk::{BulkErrorsResponse, ErrorItem};
+use elastic::client::responses::bulk::{
+    BulkErrorsResponse,
+    ErrorItem,
+};
 use elastic::http::SyncBody;
+use elastic::prelude::*;
 use elastic::Error as ResponseError;
+use ops::Client;
+use std::fs::File;
+use std::io::{
+    Error as IoError,
+    Result as IoResult,
+};
+use std::path::Path;
 
 use model;
 
@@ -23,7 +29,8 @@ impl PutBulkAccounts for Client {
         let body = bulk_body(path)?;
         let req = put(body);
 
-        let res = self.io
+        let res = self
+            .io
             .request(req)
             .params_fluent(|params| params.url_param("refresh", true))
             .send()?
@@ -51,7 +58,7 @@ where
     File::open(path)
 }
 
-quick_error!{
+quick_error! {
     #[derive(Debug)]
     pub enum PutBulkAccountsError {
         Io(err: IoError) {
diff --git a/examples/account_sample/src/ops/mod.rs b/examples/account_sample/src/ops/mod.rs
index 67a37286b0..69fca5a403 100644
--- a/examples/account_sample/src/ops/mod.rs
+++ b/examples/account_sample/src/ops/mod.rs
@@ -1,7 +1,10 @@
 pub mod commands;
 pub mod queries;
 
-use elastic::client::{SyncClient, SyncClientBuilder};
+use elastic::client::{
+    SyncClient,
+    SyncClientBuilder,
+};
 use elastic::error::Result;
 
 /// A wrapper over the `elastic::Client` that we can implement commands
diff --git a/examples/account_sample/src/ops/queries/simple_search.rs b/examples/account_sample/src/ops/queries/simple_search.rs
index 8b27847a25..a63befb02d 100644
--- a/examples/account_sample/src/ops/queries/simple_search.rs
+++ b/examples/account_sample/src/ops/queries/simple_search.rs
@@ -1,8 +1,7 @@
-use ops::Client;
-use elastic::prelude::*;
 use elastic::error::Result;
+use elastic::prelude::*;
+use ops::Client;
 
-use model;
 use model::account::Account;
 
 pub trait SimpleSearchQuery {
@@ -24,7 +23,7 @@ impl SimpleSearchQuery for Client {
                     },
                     {
                       "term": {
-                        "employer": { 
+                        "employer": {
                           "value": qry,
                           "boost": 1.3
                         }
@@ -56,9 +55,8 @@ impl SimpleSearchQuery for Client {
         });
 
         self.io
+            .document::<Account>()
             .search()
-            .index(model::index::name())
-            .ty(Some(model::account::name()))
             .body(query.to_string())
             .send()
     }
diff --git a/rustfmt.toml b/rustfmt.toml
index 2ad57bd259..e395dbae87 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -1,1 +1,2 @@
-max_width = 250
\ No newline at end of file
+imports_indent = "Block"
+imports_layout = "Vertical"
\ No newline at end of file
diff --git a/src/elastic/Cargo.toml b/src/elastic/Cargo.toml
index 7ef026a8db..9d3e64822b 100644
--- a/src/elastic/Cargo.toml
+++ b/src/elastic/Cargo.toml
@@ -15,23 +15,21 @@ appveyor = { repository = "elastic-rs/elastic" }
 
 [dependencies]
 quick-error = "~1"
-error-chain = "0.11.0"
-log = "~0.3.8"
-uuid = { version = "0.6", features = [ "v4" ] }
-url = "~1.5.1"
-bytes = "~0.4.5"
-http = "~0.1.0"
+error-chain = "~0.11"
+log = "~0.4"
+uuid = { version = "~0.6", features = [ "v4" ] }
+url = "~1"
+bytes = "~0.4"
+http = "~0.1"
 serde = "~1"
 serde_json = "~1"
 serde_derive = "~1"
-reqwest = { version = "~0.8.0", features = ["unstable"] }
-futures = "~0.1.16"
-tokio-core = "~0.1.9"
-tokio-io = "~0.1.4"
-futures-cpupool = "~0.1.6"
+reqwest = "~0.9"
+futures = "~0.1"
+tokio = "~0.1"
+tokio-threadpool = "~0.1"
 fluent_builder = "~0.5"
-tokio-timer = "~0.1.2"
-crossbeam-channel = "~0.1.2"
+crossbeam-channel = "~0.3"
 
 elastic_requests = { version = "~0.20.2", path = "../requests" }
 elastic_responses = { version = "~0.20.2", path = "../responses" }
diff --git a/src/elastic/benches/params.rs b/src/elastic/benches/params.rs
deleted file mode 100644
index 85d41cc53a..0000000000
--- a/src/elastic/benches/params.rs
+++ /dev/null
@@ -1,124 +0,0 @@
-#![feature(test)]
-
-extern crate elastic;
-extern crate reqwest;
-extern crate test;
-extern crate tokio_core;
-
-use reqwest::header::Referer;
-use tokio_core::reactor::Core;
-use elastic::client::RequestParams;
-use elastic::client::requests::PingRequest;
-
-#[inline(always)]
-fn with_headers_1(params: RequestParams) -> RequestParams {
-    params.header(Referer::new("/People.html#tim"))
-}
-
-#[inline(always)]
-fn with_headers_5(params: RequestParams) -> RequestParams {
-    params
-        .header(Referer::new("/People.html#tim"))
-        .header(Referer::new("/People.html#tim"))
-        .header(Referer::new("/People.html#tim"))
-        .header(Referer::new("/People.html#tim"))
-        .header(Referer::new("/People.html#tim"))
-}
-
-#[inline(always)]
-fn with_params_1(params: RequestParams) -> RequestParams {
-    params.url_param("query", "*")
-}
-
-#[inline(always)]
-fn with_params_5(params: RequestParams) -> RequestParams {
-    params
-        .url_param("query", "*")
-        .url_param("query", "*")
-        .url_param("query", "*")
-        .url_param("query", "*")
-        .url_param("query", "*")
-}
-
-macro_rules! bench {
-    ($($bench_name:ident),*) => (
-        $(
-            mod $bench_name {
-                use super::*;
-
-                $bench_name!(
-                    { default, RequestParams::default() },
-                    { headers_1, with_headers_1(RequestParams::default()) },
-                    { headers_5, with_headers_5(RequestParams::default()) },
-                    { params_1, with_params_1(RequestParams::default()) },
-                    { params_5, with_params_5(RequestParams::default()) }
-                );
-            }
-        )*
-    )
-}
-
-macro_rules! new {
-    ($({ $name:ident, $params:expr }),*) => (
-        $(
-            #[bench]
-            fn $name(b: &mut test::Bencher) {
-                b.iter(|| {
-                    $params
-                })
-            }
-        )*
-    )
-}
-
-macro_rules! clone {
-    ($({ $name:ident, $params:expr }),*) => (
-        $(
-            #[bench]
-            fn $name(b: &mut test::Bencher) {
-                let params = $params;
-
-                b.iter(|| {
-                    params.clone()
-                })
-            }
-        )*
-    )
-}
-
-macro_rules! get_headers {
-    ($({ $name:ident, $params:expr }),*) => (
-        $(
-            #[bench]
-            fn $name(b: &mut test::Bencher) {
-                let params = $params;
-
-                b.iter(|| {
-                    params.get_headers()
-                })
-            }
-        )*
-    )
-}
-
-macro_rules! get_url_query {
-    ($({ $name:ident, $params:expr }),*) => (
-        $(
-            #[bench]
-            fn $name(b: &mut test::Bencher) {
-                let params = $params;
-
-                b.iter(|| {
-                    params.get_url_qry()
-                })
-            }
-        )*
-    )
-}
-
-bench! {
-    new,
-    clone,
-    get_headers,
-    get_url_query
-}
diff --git a/src/elastic/benches/static_nodes.rs b/src/elastic/benches/static_nodes.rs
deleted file mode 100644
index 8e82428412..0000000000
--- a/src/elastic/benches/static_nodes.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-#![feature(test)]
-
-extern crate elastic;
-extern crate test;
-
-use test::Bencher;
-
-use elastic::client::sender::{NextParams, PreRequestParams};
-use elastic::client::sender::static_nodes::StaticNodes;
-
-#[bench]
-fn round_robin(b: &mut Bencher) {
-    let nodes = StaticNodes::round_robin(
-        vec![
-            "http://hosta:9200",
-            "http://hostb:9200",
-            "http://hostc:9200",
-        ],
-        PreRequestParams::default(),
-    );
-
-    b.iter(|| nodes.next());
-}
diff --git a/src/elastic/examples/basic.rs b/src/elastic/examples/basic.rs
index 7ba6c4eb48..ca9a82d45c 100644
--- a/src/elastic/examples/basic.rs
+++ b/src/elastic/examples/basic.rs
@@ -10,14 +10,15 @@ extern crate env_logger;
 #[macro_use]
 extern crate serde_json;
 
-use std::error::Error;
-use serde_json::Value;
 use elastic::prelude::*;
+use serde_json::Value;
+use std::error::Error;
 
 fn run() -> Result<(), Box<Error>> {
     // A reqwest HTTP client and default parameters.
-    // The `params` includes the base node url (http://localhost:9200).
-    let client = SyncClientBuilder::new().build()?;
+    let client = SyncClientBuilder::new()
+        .static_node("http://localhost:9200")
+        .build()?;
 
     // Send the request and process the response.
     let res = client
diff --git a/src/elastic/examples/basic_async.rs b/src/elastic/examples/basic_async.rs
index 1d386883e8..86fc629145 100644
--- a/src/elastic/examples/basic_async.rs
+++ b/src/elastic/examples/basic_async.rs
@@ -8,28 +8,28 @@
 extern crate elastic;
 extern crate env_logger;
 extern crate futures;
-extern crate futures_cpupool;
+extern crate tokio_threadpool;
 #[macro_use]
 extern crate serde_json;
-extern crate tokio_core;
+extern crate tokio;
 
-use std::error::Error;
+use elastic::prelude::*;
 use futures::Future;
-use futures_cpupool::CpuPool;
-use tokio_core::reactor::Core;
 use serde_json::Value;
-use elastic::prelude::*;
+use std::{
+    error::Error,
+    sync::Arc,
+};
+use tokio_threadpool::ThreadPool;
 
 fn run() -> Result<(), Box<Error>> {
-    let mut core = Core::new()?;
-    let pool = CpuPool::new(4);
-
     // A reqwest HTTP client and default parameters.
-    // The `params` includes the base node url (http://localhost:9200).
     // We also specify a cpu pool for serialising and deserialising data on.
+    // The cpu pool is optional.
     let client = AsyncClientBuilder::new()
-        .serde_pool(pool)
-        .build(&core.handle())?;
+        .static_node("http://localhost:9200")
+        .serde_pool(Arc::new(ThreadPool::new()))
+        .build()?;
 
     // Send the request and process the response.
     let res_future = client
@@ -53,7 +53,7 @@ fn run() -> Result<(), Box<Error>> {
         Ok(())
     });
 
-    core.run(search_future)?;
+    tokio::executor::current_thread::block_on_all(search_future)?;
 
     Ok(())
 }
diff --git a/src/elastic/examples/bulk.rs b/src/elastic/examples/bulk.rs
index 2f60ba6516..903a91d37f 100644
--- a/src/elastic/examples/bulk.rs
+++ b/src/elastic/examples/bulk.rs
@@ -12,23 +12,25 @@ extern crate env_logger;
 #[macro_use]
 extern crate serde_json;
 
-use std::error::Error;
 use elastic::prelude::*;
+use std::error::Error;
 
 fn run() -> Result<(), Box<Error>> {
     // A HTTP client and request parameters
     let client = SyncClientBuilder::new().build()?;
 
-    let ops = (0..1000)
-        .into_iter()
-        .map(|i| bulk_raw().index(json!({
+    let ops = (0..1000).into_iter().map(|i| {
+        bulk_raw()
+            .index(json!({
                 "id": i,
                 "title": "some string value"
             }))
-            .id(i));
+            .id(i)
+    });
 
     // Execute a bulk request
-    let bulk = client.bulk()
+    let bulk = client
+        .bulk()
         .index("bulk_idx")
         .ty("bulk_ty")
         .extend(ops)
diff --git a/src/elastic/examples/bulk_async.rs b/src/elastic/examples/bulk_async.rs
index 3a7695fa87..03b0dd752a 100644
--- a/src/elastic/examples/bulk_async.rs
+++ b/src/elastic/examples/bulk_async.rs
@@ -10,31 +10,30 @@
 extern crate elastic;
 extern crate env_logger;
 extern crate futures;
-extern crate tokio_core;
+extern crate tokio;
 #[macro_use]
 extern crate serde_json;
 
-use std::error::Error;
-use futures::Future;
-use tokio_core::reactor::Core;
 use elastic::prelude::*;
+use futures::Future;
+use std::error::Error;
 
 fn run() -> Result<(), Box<Error>> {
-    let mut core = Core::new()?;
-
     // A HTTP client and request parameters
-    let client = AsyncClientBuilder::new().build(&core.handle())?;
+    let client = AsyncClientBuilder::new().build()?;
 
-    let ops = (0..1000)
-        .into_iter()
-        .map(|i| bulk_raw().index(json!({
+    let ops = (0..1000).into_iter().map(|i| {
+        bulk_raw()
+            .index(json!({
                 "id": i,
                 "title": "some string value"
             }))
-            .id(i));
+            .id(i)
+    });
 
     // Execute a bulk request
-    let res_future = client.bulk()
+    let res_future = client
+        .bulk()
         .index("bulk_idx")
         .ty("bulk_ty")
         .extend(ops)
@@ -51,7 +50,7 @@ fn run() -> Result<(), Box<Error>> {
         Ok(())
     });
 
-    core.run(res_future)?;
+    tokio::executor::current_thread::block_on_all(res_future)?;
 
     Ok(())
 }
diff --git a/src/elastic/examples/bulk_async_stream.rs b/src/elastic/examples/bulk_async_stream.rs
index ddc68e3022..2a42d51a2d 100644
--- a/src/elastic/examples/bulk_async_stream.rs
+++ b/src/elastic/examples/bulk_async_stream.rs
@@ -10,38 +10,42 @@
 extern crate elastic;
 extern crate env_logger;
 extern crate futures;
-extern crate tokio_core;
+extern crate tokio;
 #[macro_use]
 extern crate serde_json;
 
+use elastic::prelude::*;
+use futures::{
+    stream,
+    Future,
+    Sink,
+    Stream,
+};
 use std::error::Error;
 use std::time::Duration;
-use futures::{stream, Future, Stream, Sink};
-use tokio_core::reactor::Core;
-use elastic::prelude::*;
 
 fn run() -> Result<(), Box<Error>> {
-    let mut core = Core::new()?;
-
     // A HTTP client and request parameters
-    let client = AsyncClientBuilder::new().build(&core.handle())?;
+    let client = AsyncClientBuilder::new().build()?;
 
     // Get a stream for bulk operations
     // Individual operations can be sent to the stream and will be buffered to Elasticsearch
-    let (bulk_stream, bulk_responses) = client.bulk_stream()
+    let (bulk_stream, bulk_responses) = client
+        .bulk_stream()
         .index("bulk_idx")
         .ty("bulk_ty")
         .timeout(Duration::from_secs(5))
         .body_size_bytes(1024)
         .build();
 
-    let ops = (0..1000)
-        .into_iter()
-        .map(|i| bulk_raw().index(json!({
+    let ops = (0..1000).into_iter().map(|i| {
+        bulk_raw()
+            .index(json!({
                 "id": i,
                 "title": "some string value"
             }))
-            .id(i));
+            .id(i)
+    });
 
     let req_future = bulk_stream.send_all(stream::iter_ok(ops));
 
@@ -57,7 +61,7 @@ fn run() -> Result<(), Box<Error>> {
         Ok(())
     });
 
-    core.run(req_future.join(res_future))?;
+    tokio::executor::current_thread::block_on_all(req_future.join(res_future))?;
 
     Ok(())
 }
diff --git a/src/elastic/examples/custom_response.rs b/src/elastic/examples/custom_response.rs
index 1c58b4334f..4556712ad9 100644
--- a/src/elastic/examples/custom_response.rs
+++ b/src/elastic/examples/custom_response.rs
@@ -13,10 +13,10 @@ extern crate serde_derive;
 #[macro_use]
 extern crate serde_json;
 
-use std::error::Error;
-use serde_json::Value;
-use elastic::prelude::*;
 use elastic::client::responses::parse::*;
+use elastic::prelude::*;
+use serde_json::Value;
+use std::error::Error;
 
 #[derive(Deserialize, Debug)]
 struct SearchResponse {
@@ -30,12 +30,13 @@ struct Hits {
 
 #[derive(Deserialize, Debug)]
 struct Hit {
-    #[serde(rename = "_source")] pub source: Value,
+    #[serde(rename = "_source")]
+    pub source: Value,
 }
 
 // Implement `IsOkOnSuccess` for our custom `SearchResponse` so it can be used in the call to `into_response`.
 // `IsOkOnSuccess` will return `Ok` if the response is in the `200` range.
-impl IsOkOnSuccess for SearchResponse { }
+impl IsOkOnSuccess for SearchResponse {}
 
 fn run() -> Result<(), Box<Error>> {
     // A reqwest HTTP client and default parameters.
diff --git a/src/elastic/examples/get.rs b/src/elastic/examples/get.rs
index bf9ae94a92..0fffb8a123 100644
--- a/src/elastic/examples/get.rs
+++ b/src/elastic/examples/get.rs
@@ -11,10 +11,13 @@ extern crate elastic;
 extern crate env_logger;
 extern crate serde_json;
 
-use std::error::Error as StdError;
-use serde_json::Value;
-use elastic::error::{ApiError, Error};
+use elastic::error::{
+    ApiError,
+    Error,
+};
 use elastic::prelude::*;
+use serde_json::Value;
+use std::error::Error as StdError;
 
 fn run() -> Result<(), Box<StdError>> {
     // A reqwest HTTP client and default parameters.
@@ -22,7 +25,8 @@ fn run() -> Result<(), Box<StdError>> {
     let client = SyncClientBuilder::new().build()?;
 
     let res = client
-        .document::<Value>().get_raw("typed_sample_index", "1")
+        .document::<Value>()
+        .get_raw("typed_sample_index", "1")
         .send();
 
     // Responses can be unpacked in various ways. In this case we check if:
diff --git a/src/elastic/examples/index.rs b/src/elastic/examples/index.rs
index ccadbbd961..706ac4ea5f 100644
--- a/src/elastic/examples/index.rs
+++ b/src/elastic/examples/index.rs
@@ -14,8 +14,8 @@ extern crate serde_derive;
 
 extern crate elastic;
 
-use std::error::Error;
 use elastic::prelude::*;
+use std::error::Error;
 
 #[derive(Debug, Serialize, Deserialize, ElasticType)]
 #[elastic(index = "index_sample_index")]
@@ -38,21 +38,20 @@ fn run() -> Result<(), Box<Error>> {
     };
 
     // Create the index if it doesn't exist
-    if !client.index(MyType::static_index()).exists().send()?.exists() {
+    if !client
+        .index(MyType::static_index())
+        .exists()
+        .send()?
+        .exists()
+    {
         client.index(MyType::static_index()).create().send()?;
     }
 
     // Add the document mapping (optional, but makes sure `timestamp` is mapped as a `date`)
-    client
-        .document::<MyType>()
-        .put_mapping()
-        .send()?;
+    client.document::<MyType>().put_mapping().send()?;
 
     // Index the document
-    client
-        .document()
-        .index(doc)
-        .send()?;
+    client.document().index(doc).send()?;
 
     Ok(())
 }
diff --git a/src/elastic/examples/load_balanced_async.rs b/src/elastic/examples/load_balanced_async.rs
index 0d4f4f578e..a9bc47298a 100644
--- a/src/elastic/examples/load_balanced_async.rs
+++ b/src/elastic/examples/load_balanced_async.rs
@@ -7,20 +7,17 @@
 extern crate elastic;
 extern crate env_logger;
 extern crate futures;
-extern crate tokio_core;
+extern crate tokio;
 
-use std::error::Error;
-use futures::Future;
-use tokio_core::reactor::Core;
 use elastic::prelude::*;
+use futures::Future;
+use std::error::Error;
 
 fn run() -> Result<(), Box<Error>> {
-    let mut core = Core::new()?;
-
     // An async HTTP client that will sniff node addresses from the given base address.
     let client = AsyncClientBuilder::new()
         .sniff_nodes("http://localhost:9200")
-        .build(&core.handle())?;
+        .build()?;
 
     // Send the request and process the response.
     let ping_future = client
@@ -33,7 +30,7 @@ fn run() -> Result<(), Box<Error>> {
             Ok(())
         });
 
-    core.run(ping_future)?;
+    tokio::executor::current_thread::block_on_all(ping_future)?;
 
     Ok(())
 }
diff --git a/src/elastic/examples/ping.rs b/src/elastic/examples/ping.rs
index d6942e06ab..f8b0da5820 100644
--- a/src/elastic/examples/ping.rs
+++ b/src/elastic/examples/ping.rs
@@ -5,8 +5,8 @@
 extern crate elastic;
 extern crate env_logger;
 
-use std::error::Error;
 use elastic::prelude::*;
+use std::error::Error;
 
 fn run() -> Result<(), Box<Error>> {
     // A HTTP client and request parameters
diff --git a/src/elastic/examples/pre_send.rs b/src/elastic/examples/pre_send.rs
index 43ace13853..e2268c8a1c 100644
--- a/src/elastic/examples/pre_send.rs
+++ b/src/elastic/examples/pre_send.rs
@@ -3,39 +3,51 @@
 //! NOTE: This sample expects you have a node running on `localhost:9200`.
 
 extern crate elastic;
-extern crate reqwest;
 extern crate env_logger;
+extern crate reqwest;
 
-use std::error::Error;
-use std::io::Read;
-use std::collections::hash_map::DefaultHasher;
-use std::hash::{Hash, Hasher};
+use elastic::http::{
+    header::{
+        HeaderName,
+        HeaderValue,
+    },
+    SyncHttpRequest,
+};
 use elastic::prelude::*;
-use elastic::http::SyncHttpRequest;
+use std::{
+    collections::hash_map::DefaultHasher,
+    error::Error,
+    hash::{
+        Hash,
+        Hasher,
+    },
+    io::Read,
+    str::FromStr,
+};
 
 fn hash_request(request: &mut SyncHttpRequest) -> Result<(), Box<Error + Send + Sync>> {
-    let &mut SyncHttpRequest { ref mut url, ref mut method, ref mut body, ref mut headers, .. } = request;
-
     // Read the body into a temporary buffer
     let mut buffered = Vec::new();
-    if let &mut Some(ref mut body) = body {
+    if let Some(ref mut body) = request.body_mut() {
         body.reader().read_to_end(&mut buffered)?;
     }
 
     // Access the request data
     let mut hasher = DefaultHasher::new();
 
-    url.hash(&mut hasher);
-    method.hash(&mut hasher);
+    request.url_mut().hash(&mut hasher);
+    request.method_mut().hash(&mut hasher);
     buffered.hash(&mut hasher);
-    
-    for header in headers.iter() {
-        header.to_string().hash(&mut hasher);
+
+    for (key, value) in request.headers_mut().iter() {
+        format!("{}: {}", key, value.to_str()?).hash(&mut hasher);
     }
-    
+
     // Add a raw header to the request
     let hash = hasher.finish();
-    headers.set_raw("X-BadHash", hash.to_string());
+    request
+        .headers_mut()
+        .insert(HeaderName::from_str("X-BadHash")?, HeaderValue::from(hash));
 
     Ok(())
 }
diff --git a/src/elastic/examples/raw.rs b/src/elastic/examples/raw.rs
index 7164856e2c..5dee28866c 100644
--- a/src/elastic/examples/raw.rs
+++ b/src/elastic/examples/raw.rs
@@ -8,9 +8,9 @@
 extern crate elastic;
 extern crate env_logger;
 
+use elastic::prelude::*;
 use std::error::Error;
 use std::io::Read;
-use elastic::prelude::*;
 
 fn run() -> Result<(), Box<Error>> {
     // A reqwest HTTP client and default parameters.
diff --git a/src/elastic/examples/typed.rs b/src/elastic/examples/typed.rs
index 465e5b75b3..ad39df0e5d 100644
--- a/src/elastic/examples/typed.rs
+++ b/src/elastic/examples/typed.rs
@@ -21,9 +21,12 @@ extern crate serde_json;
 
 extern crate elastic;
 
-use std::error::Error as StdError;
-use elastic::error::{ApiError, Error};
+use elastic::error::{
+    ApiError,
+    Error,
+};
 use elastic::prelude::*;
+use std::error::Error as StdError;
 
 #[derive(Debug, Serialize, Deserialize, ElasticType)]
 #[elastic(index = "typed_sample_index")]
@@ -57,10 +60,7 @@ fn run() -> Result<(), Box<StdError>> {
 }
 
 fn ensure_indexed(client: &SyncClient, doc: MyType) -> Result<(), Error> {
-    let get_res = client
-        .document::<MyType>()
-        .get(doc.id.clone())
-        .send();
+    let get_res = client.document::<MyType>().get(doc.id.clone()).send();
 
     match get_res.map(|res| res.into_document()) {
         // The doc was found: no need to index
@@ -89,10 +89,7 @@ fn ensure_indexed(client: &SyncClient, doc: MyType) -> Result<(), Error> {
 
 fn put_index(client: &SyncClient) -> Result<(), Error> {
     client.index(MyType::static_index()).create().send()?;
-    client
-        .document::<MyType>()
-        .put_mapping()
-        .send()?;
+    client.document::<MyType>().put_mapping().send()?;
 
     Ok(())
 }
@@ -112,12 +109,12 @@ fn search(client: &SyncClient, query: &'static str) -> Result<SearchResponse<MyT
         .search()
         .index(MyType::static_index())
         .body(json!({
-                "query": {
-                    "query_string": {
-                        "query": query
-                    }
-                }
-          }))
+              "query": {
+                  "query_string": {
+                      "query": query
+                  }
+              }
+        }))
         .send()
 }
 
diff --git a/src/elastic/examples/typed_async.rs b/src/elastic/examples/typed_async.rs
index 46f23e66c6..38dd9f9056 100644
--- a/src/elastic/examples/typed_async.rs
+++ b/src/elastic/examples/typed_async.rs
@@ -19,14 +19,20 @@ extern crate serde;
 extern crate serde_derive;
 #[macro_use]
 extern crate serde_json;
-extern crate tokio_core;
+extern crate tokio;
 
 extern crate elastic;
 
-use std::error::Error as StdError;
-use futures::{Future, IntoFuture};
+use elastic::error::{
+    ApiError,
+    Error,
+};
 use elastic::prelude::*;
-use elastic::error::{ApiError, Error};
+use futures::{
+    Future,
+    IntoFuture,
+};
+use std::error::Error as StdError;
 
 #[derive(Debug, Serialize, Deserialize, ElasticType)]
 #[elastic(index = "typed_sample_index")]
@@ -38,10 +44,8 @@ struct MyType {
 }
 
 fn run() -> Result<(), Box<StdError>> {
-    let mut core = tokio_core::reactor::Core::new()?;
-
     // A HTTP client and request parameters
-    let client = AsyncClientBuilder::new().build(&core.handle())?;
+    let client = AsyncClientBuilder::new().build()?;
 
     // Create a document to index
     let doc = MyType {
@@ -62,7 +66,7 @@ fn run() -> Result<(), Box<StdError>> {
         Ok(())
     });
 
-    core.run(res_future)?;
+    tokio::executor::current_thread::block_on_all(res_future)?;
 
     Ok(())
 }
@@ -107,11 +111,7 @@ fn ensure_indexed(client: AsyncClient, doc: MyType) -> Box<Future<Item = (), Err
 fn put_index(client: AsyncClient) -> Box<Future<Item = (), Error = Error>> {
     let create_index = client.index(MyType::static_index()).create().send();
 
-    let put_mapping = client
-        .document::<MyType>()
-        .put_mapping()
-        .send()
-        .map(|_| ());
+    let put_mapping = client.document::<MyType>().put_mapping().send().map(|_| ());
 
     Box::new(create_index.and_then(|_| put_mapping))
 }
@@ -127,17 +127,20 @@ fn put_doc(client: AsyncClient, doc: MyType) -> Box<Future<Item = (), Error = Er
     Box::new(index_doc)
 }
 
-fn search(client: AsyncClient, query: &'static str) -> Box<Future<Item = SearchResponse<MyType>, Error = Error>> {
+fn search(
+    client: AsyncClient,
+    query: &'static str,
+) -> Box<Future<Item = SearchResponse<MyType>, Error = Error>> {
     let search = client
         .search()
         .index(MyType::static_index())
         .body(json!({
-                "query": {
-                    "query_string": {
-                        "query": query
-                    }
-                }
-          }))
+              "query": {
+                  "query_string": {
+                      "query": query
+                  }
+              }
+        }))
         .send();
 
     Box::new(search)
diff --git a/src/elastic/examples/update.rs b/src/elastic/examples/update.rs
index 2c06b40d0c..86fdf258f4 100644
--- a/src/elastic/examples/update.rs
+++ b/src/elastic/examples/update.rs
@@ -14,8 +14,8 @@ extern crate serde_derive;
 
 extern crate elastic;
 
-use std::error::Error;
 use elastic::prelude::*;
+use std::error::Error;
 
 #[derive(Debug, Serialize, Deserialize, ElasticType)]
 #[elastic(index = "index_sample_index")]
@@ -41,10 +41,7 @@ fn run() -> Result<(), Box<Error>> {
     client.index(MyType::static_index()).create().send()?;
 
     // Add the document mapping (optional, but makes sure `timestamp` is mapped as a `date`)
-    client
-        .document::<MyType>()
-        .put_mapping()
-        .send()?;
+    client.document::<MyType>().put_mapping().send()?;
 
     // Index the document
     client
diff --git a/src/elastic/src/client/mod.rs b/src/elastic/src/client/mod.rs
index 3754e6ec72..cc32e39cce 100644
--- a/src/elastic/src/client/mod.rs
+++ b/src/elastic/src/client/mod.rs
@@ -31,16 +31,13 @@ The response is returned as a `Result`.
 
 Use an [`AsyncClientBuilder`][AsyncClientBuilder] to configure an asynchronous client.
 
-The asynchronous client requires a handle to a `tokio::reactor::Core`:
-
 ```
-# extern crate tokio_core;
+# extern crate tokio;
 # extern crate elastic;
 # use elastic::prelude::*;
 # fn main() { run().unwrap() }
 # fn run() -> Result<(), Box<::std::error::Error>> {
-# let core = tokio_core::reactor::Core::new()?;
-let client = AsyncClientBuilder::new().build(&core.handle())?;
+let client = AsyncClientBuilder::new().build()?;
 # Ok(())
 # }
 ```
@@ -63,7 +60,51 @@ Requests can be sent with an instance of a client using a builder API:
 # let client = SyncClientBuilder::new().build()?;
 let response = client.search::<Value>()
                      .index("myindex")
-                     .ty(Some("myty"))
+                     .ty("myty")
+                     .body(json!({
+                         "query": {
+                             "query_string": {
+                                 "query": "*"
+                             }
+                         }
+                     }))
+                     .send();
+
+match response {
+    Ok(response) => {
+        // Iterate through the response hits
+        for hit in response.hits() {
+            println!("{:?}", hit);
+        }
+    },
+    Err(Error::Api(e)) => {
+        // handle a REST API error
+    },
+    Err(e) => {
+        // handle a HTTP or JSON error
+    }
+}
+# Ok(())
+# }
+```
+
+Requests that work with [document types][documents-mod] can infer index and type metadata:
+
+```no_run
+# #[macro_use] extern crate serde_json;
+# #[macro_use] extern crate elastic_derive;
+# #[macro_use] extern crate serde_derive;
+# extern crate elastic;
+# use serde_json::Value;
+# use elastic::prelude::*;
+# use elastic::Error;
+# fn main() { run().unwrap() }
+# fn run() -> Result<(), Box<::std::error::Error>> {
+# let client = SyncClientBuilder::new().build()?;
+# #[derive(ElasticType, Deserialize, Debug)]
+# struct MyType { }
+let response = client.document::<MyType>()
+                     .search()
                      .body(json!({
                          "query": {
                              "query_string": {
@@ -365,7 +406,7 @@ Call [`AsyncResponseBuilder.into_response`][AsyncResponseBuilder.into_response]
 
 ```no_run
 # extern crate futures;
-# extern crate tokio_core;
+# extern crate tokio;
 # extern crate serde;
 # extern crate serde_json;
 # #[macro_use] extern crate serde_derive;
@@ -382,8 +423,7 @@ Call [`AsyncResponseBuilder.into_response`][AsyncResponseBuilder.into_response]
 #     pub title: String,
 #     pub timestamp: Date<DefaultDateMapping>
 # }
-# let core = tokio_core::reactor::Core::new()?;
-# let client = AsyncClientBuilder::new().build(&core.handle())?;
+# let client = AsyncClientBuilder::new().build()?;
 # let req = PingRequest::new();
 let future = client.request(req)
                    .send()
@@ -405,7 +445,7 @@ Alternatively, call [`AsyncResponseBuilder.into_raw`][AsyncResponseBuilder.into_
 
 ```no_run
 # extern crate futures;
-# extern crate tokio_core;
+# extern crate tokio;
 # extern crate serde;
 # #[macro_use] extern crate serde_derive;
 # #[macro_use] extern crate elastic_derive;
@@ -416,8 +456,7 @@ Alternatively, call [`AsyncResponseBuilder.into_raw`][AsyncResponseBuilder.into_
 # use elastic::prelude::*;
 # fn main() { run().unwrap() }
 # fn run() -> Result<(), Box<::std::error::Error>> {
-# let core = tokio_core::reactor::Core::new()?;
-# let client = AsyncClientBuilder::new().build(&core.handle())?;
+# let client = AsyncClientBuilder::new().build()?;
 # let req = PingRequest::new();
 let future = client.request(req)
                    .send()
@@ -512,17 +551,29 @@ For more details see the [`responses`][responses-mod] module.
 [SyncHttpResponse]: responses/struct.SyncHttpResponse.html
 [AsyncHttpResponse]: responses/struct.AsyncHttpResponse.html
 [response-types]: responses/parse/trait.IsOk.html#implementors
+
+[documents-mod]: ../types/documents/index.html
 */
 
-pub mod sender;
 pub mod requests;
 pub mod responses;
+pub mod sender;
 
-pub use self::sender::{AsyncClient, AsyncClientBuilder, PreRequestParams, RequestParams, SyncClient, SyncClientBuilder};
+pub use self::sender::{
+    AsyncClient,
+    AsyncClientBuilder,
+    PreRequestParams,
+    RequestParams,
+    SyncClient,
+    SyncClientBuilder,
+};
 
-use std::marker::PhantomData;
-use self::sender::{Sender, NodeAddresses};
 use self::requests::params::Index;
+use self::sender::{
+    NodeAddresses,
+    Sender,
+};
+use std::marker::PhantomData;
 
 /**
 A HTTP client for the Elasticsearch REST API.
@@ -555,21 +606,19 @@ Create an asynchronous `Client` and send a ping request:
 
 ```no_run
 # extern crate futures;
-# extern crate tokio_core;
+# extern crate tokio;
 # extern crate elastic;
 # use futures::Future;
-# use tokio_core::reactor::Core;
 # use elastic::prelude::*;
 # fn main() { run().unwrap() }
 # fn run() -> Result<(), Box<::std::error::Error>> {
-let mut core = Core::new()?;
-let client = AsyncClientBuilder::new().build(&core.handle())?;
+let client = AsyncClientBuilder::new().build()?;
 
 let response_future = client.request(PingRequest::new())
                             .send()
                             .and_then(|res| res.into_response::<PingResponse>());
 
-core.run(response_future)?;
+tokio::runtime::current_thread::block_on_all(response_future)?;
 # Ok(())
 # }
 ```
@@ -588,8 +637,8 @@ where
     TSender: Sender,
 {
     /**
-    Get a client for a specific document type.
-    
+    Get a client for working with specific document type.
+
     The document type can provide extra metadata like index and type names
     that can be used to simplify other API methods.
     */
@@ -601,12 +650,9 @@ where
     }
 
     /**
-    Get a client for a specific index.
+    Get a client for working with a specific index.
     */
-    pub fn index<TIndex>(&self, index: TIndex) -> IndexClient<TSender>
-    where
-        TIndex: Into<Index<'static>>,
-    {
+    pub fn index(&self, index: impl Into<Index<'static>>) -> IndexClient<TSender> {
         IndexClient {
             inner: (*self).clone(),
             index: index.into(),
@@ -639,10 +685,18 @@ pub struct IndexClient<TSender> {
 pub mod prelude {
     /*! A glob import for convenience. */
 
-    pub use super::sender::{PreRequestParams, RequestParams};
-    pub use super::{AsyncClient, AsyncClientBuilder, SyncClient, SyncClientBuilder};
     pub use super::requests::prelude::*;
     pub use super::responses::prelude::*;
+    pub use super::sender::{
+        PreRequestParams,
+        RequestParams,
+    };
+    pub use super::{
+        AsyncClient,
+        AsyncClientBuilder,
+        SyncClient,
+        SyncClientBuilder,
+    };
 }
 
 #[cfg(test)]
diff --git a/src/elastic/src/client/requests/bulk/mod.rs b/src/elastic/src/client/requests/bulk/mod.rs
index 590952b477..c42d4b764b 100644
--- a/src/elastic/src/client/requests/bulk/mod.rs
+++ b/src/elastic/src/client/requests/bulk/mod.rs
@@ -4,28 +4,50 @@ Builders for [bulk requests][docs-bulk].
 [docs-bulk]: https://www.elastic.co/guide/en/elasticsearch/reference/current/bulk.html
 */
 
-use std::fmt;
 use std::error::Error as StdError;
-use std::time::Duration;
+use std::fmt;
 use std::marker::PhantomData;
+use std::time::Duration;
 
-use futures::{Future, Poll};
-use serde::ser::Serialize;
+use futures::{
+    Future,
+    Poll,
+};
 use serde::de::DeserializeOwned;
+use serde::ser::Serialize;
 
-use error::{self, Error};
-use client::{Client, RequestParams};
-use client::sender::{AsyncSender, Sender, SyncSender};
-use client::requests::RequestBuilder;
-use http::{SyncBody, AsyncBody};
-use client::requests::params::{Index, Type};
 use client::requests::endpoints::BulkRequest;
+use client::requests::params::{
+    Index,
+    Type,
+};
 use client::requests::raw::RawRequestInner;
-use client::responses::{BulkResponse, BulkErrorsResponse};
+use client::requests::RequestBuilder;
 use client::responses::parse::IsOk;
+use client::responses::{
+    BulkErrorsResponse,
+    BulkResponse,
+};
+use client::sender::{
+    AsyncSender,
+    Sender,
+    SyncSender,
+};
+use client::{
+    Client,
+    RequestParams,
+};
+use error::{
+    self,
+    Error,
+};
+use http::{
+    AsyncBody,
+    SyncBody,
+};
 
 /**
-A [bulk request][docs-bulk] builder that can be configured before sending. 
+A [bulk request][docs-bulk] builder that can be configured before sending.
 
 Call [`Client.bulk`][Client.bulk] to get a `BulkRequestBuilder`.
 The `send` method will either send the request [synchronously][send-sync] or [asynchronously][send-async], depending on the `Client` it was created from.
@@ -38,13 +60,14 @@ Call [`Client.bulk_stream`][Client.bulk_stream] to get a `BulkRequestBuilder` th
 [Client.bulk]: ../../struct.Client.html#bulk-request
 [Client.bulk_stream]: ../../struct.Client.html#bulk-stream-request
 */
-pub type BulkRequestBuilder<TSender, TBody, TResponse> = RequestBuilder<TSender, BulkRequestInner<TBody, TResponse>>;
+pub type BulkRequestBuilder<TSender, TBody, TResponse> =
+    RequestBuilder<TSender, BulkRequestInner<TBody, TResponse>>;
 
-mod stream;
 mod operation;
+mod stream;
 
-pub use self::stream::*;
 pub use self::operation::*;
+pub use self::stream::*;
 
 #[doc(hidden)]
 pub struct BulkRequestInner<TBody, TResponse> {
@@ -61,7 +84,7 @@ impl<TSender> Client<TSender>
 where
     TSender: Sender,
 {
-    /** 
+    /**
     Create a [`BulkRequestBuilder`][BulkRequestBuilder] with this `Client` that can be configured before sending.
 
     For more details, see:
@@ -139,7 +162,7 @@ where
 # Bulk stream request
 */
 impl Client<AsyncSender> {
-    /** 
+    /**
     Create a [`BulkRequestBuilder`][BulkRequestBuilder] with this `Client` that can be configured before sending.
 
     This method can configure a channel that individual bulk operations can be sent to.
@@ -159,7 +182,7 @@ impl Client<AsyncSender> {
     ```no_run
     # extern crate serde;
     # extern crate futures;
-    # extern crate tokio_core;
+    # extern crate tokio;
     # #[macro_use] extern crate serde_derive;
     # #[macro_use] extern crate elastic_derive;
     # extern crate elastic;
@@ -173,8 +196,7 @@ impl Client<AsyncSender> {
     #     pub id: String,
     #     pub title: String,
     # }
-    # let core = tokio_core::reactor::Core::new()?;
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     let (bulk_stream, bulk_responses) = client.bulk_stream()
         .index("bulk_idx")
         .ty(MyType::static_ty())
@@ -215,7 +237,9 @@ impl Client<AsyncSender> {
     [documents-mod]: ../../types/document/index.html
     [docs-querystring]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html
     */
-    pub fn bulk_stream<TDocument>(&self) -> BulkRequestBuilder<AsyncSender, Streamed<TDocument>, BulkResponse> {
+    pub fn bulk_stream<TDocument>(
+        &self,
+    ) -> BulkRequestBuilder<AsyncSender, Streamed<TDocument>, BulkResponse> {
         RequestBuilder::initial(
             self.clone(),
             BulkRequestInner {
@@ -239,37 +263,31 @@ where
 {
     /**
     Set the default type for the bulk request.
-    
+
     If an operation doesn't specify a type, then it will default to the supplied value here.
-    
+
     # Deferred errors
-    
+
     Calling `ty` without also calling `index` will result in an error when sending the request.
     */
-    pub fn ty<I>(mut self, ty: I) -> Self
-    where
-        I: Into<Type<'static>>,
-    {
+    pub fn ty(mut self, ty: impl Into<Type<'static>>) -> Self {
         self.inner.ty = Some(ty.into());
         self
     }
 
     /**
     Set the default index for the bulk request.
-    
+
     If an operation doesn't specify an index, then it will default to the supplied value here.
     */
-    pub fn index<I>(mut self, index: I) -> Self
-    where
-        I: Into<Index<'static>>,
-    {
+    pub fn index(mut self, index: impl Into<Index<'static>>) -> Self {
         self.inner.index = Some(index.into());
         self
     }
 
     /**
     Set the type used to deserialize the index field on the response.
-    
+
     Sometimes a bulk response will use the same index value many times.
     To avoid allocating a lot of individual strings, the type used to deserialize the field can be changed.
     `string_cache::DefaultAtom` or a custom `enum` can be effective ways to reduce allocations in large bulk responses.
@@ -292,7 +310,7 @@ where
 
     /**
     Set the type used to deserialize the type field on the response.
-    
+
     Sometimes a bulk response will use the same type value many times.
     To avoid allocating a lot of individual strings, the type used to deserialize the field can be changed.
     `string_cache::DefaultAtom` or a custom `enum` can be effective ways to reduce allocations in large bulk responses.
@@ -315,7 +333,7 @@ where
 
     /**
     Set the type used to deserialize the id field on the response.
-    
+
     It's less likely that id fields in bulk responses will be repeated, but they're probably short.
     To avoid allocating a lot of individual strings, the type used to deserialize the field can be changed.
     `inlinable_string::InlinableString` can be an effective way to recude allocation in large bulk responses.
@@ -337,7 +355,8 @@ where
     }
 }
 
-impl<TSender, TBody, TIndex, TType, TId> BulkRequestBuilder<TSender, TBody, BulkResponse<TIndex, TType, TId>>
+impl<TSender, TBody, TIndex, TType, TId>
+    BulkRequestBuilder<TSender, TBody, BulkResponse<TIndex, TType, TId>>
 where
     TSender: Sender,
 {
@@ -347,7 +366,9 @@ where
     Elasticsearch returns a response that's proportional in size to the number of operations in the request.
     If you only care about failures then it can be more efficient to ignore the common case where operations succeed.
     */
-    pub fn errors_only(self) -> BulkRequestBuilder<TSender, TBody, BulkErrorsResponse<TIndex, TType, TId>> {
+    pub fn errors_only(
+        self,
+    ) -> BulkRequestBuilder<TSender, TBody, BulkErrorsResponse<TIndex, TType, TId>> {
         RequestBuilder::new(
             self.client,
             self.params_builder,
@@ -409,14 +430,16 @@ where
     }
 }
 
-impl<TSender, TBody, TDocument, TResponse> Extend<BulkOperation<TDocument>> for BulkRequestBuilder<TSender, TBody, TResponse>
+impl<TSender, TBody, TDocument, TResponse> Extend<BulkOperation<TDocument>>
+    for BulkRequestBuilder<TSender, TBody, TResponse>
 where
     TSender: Sender,
     TBody: BulkBody,
     TDocument: Serialize,
 {
-    fn extend<T>(&mut self, iter: T) where
-    T: IntoIterator<Item = BulkOperation<TDocument>>,
+    fn extend<T>(&mut self, iter: T)
+    where
+        T: IntoIterator<Item = BulkOperation<TDocument>>,
     {
         for op in iter.into_iter() {
             self.push_internal(op);
@@ -474,7 +497,11 @@ impl<TDocument, TResponse> BulkRequestBuilder<AsyncSender, Streamed<TDocument>,
     > TODO
     */
     pub fn build(self) -> (BulkSender<TDocument, TResponse>, BulkReceiver<TResponse>) {
-        let body = self.inner.body.try_into_inner().expect("building a stream should be infallible");
+        let body = self
+            .inner
+            .body
+            .try_into_inner()
+            .expect("building a stream should be infallible");
 
         let body_size = body.body_size;
         let duration = body.timeout;
@@ -482,7 +509,8 @@ impl<TDocument, TResponse> BulkRequestBuilder<AsyncSender, Streamed<TDocument>,
         let params = self.params_builder.into_value(RequestParams::default);
         let body = SenderBody::new(body_size);
         let timeout = Timeout::new(duration);
-        let req_template = SenderRequestTemplate::new(self.client, params, self.inner.index, self.inner.ty);
+        let req_template =
+            SenderRequestTemplate::new(self.client, params, self.inner.index, self.inner.ty);
 
         BulkSender::new(req_template, timeout, body)
     }
@@ -496,19 +524,12 @@ where
         let body = self.body.try_into_inner()?;
 
         match (self.index, self.ty) {
-            (Some(index), None) => Ok(BulkRequest::for_index(
-                index,
-                body,
-            )),
-            (Some(index), Some(ty)) => Ok(BulkRequest::for_index_ty(
-                index,
-                ty,
-                body,
-            )),
-            (None, None) => Ok(BulkRequest::new(
-                body,
-            )),
-            (None, Some(_)) => Err(error::request(BulkRequestError("missing `index` parameter".to_owned())))
+            (Some(index), None) => Ok(BulkRequest::for_index(index, body)),
+            (Some(index), Some(ty)) => Ok(BulkRequest::for_index_ty(index, ty, body)),
+            (None, None) => Ok(BulkRequest::new(body)),
+            (None, Some(_)) => Err(error::request(BulkRequestError(
+                "missing `index` parameter".to_owned(),
+            ))),
         }
     }
 }
@@ -591,7 +612,7 @@ where
 {
     /**
     Send a `BulkRequestBuilder` asynchronously using an [`AsyncClient`][AsyncClient].
-    
+
     This will return a future that will resolve to the deserialised search response.
 
     # Examples
@@ -601,7 +622,7 @@ where
     ```no_run
     # extern crate serde;
     # extern crate futures;
-    # extern crate tokio_core;
+    # extern crate tokio;
     # #[macro_use] extern crate serde_derive;
     # #[macro_use] extern crate elastic_derive;
     # extern crate elastic;
@@ -614,8 +635,7 @@ where
     #     pub id: String,
     #     pub title: String,
     # }
-    # let core = tokio_core::reactor::Core::new()?;
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     let ops = (0..1000)
         .into_iter()
         .map(|i| bulk::<MyType>().index(MyType {
@@ -692,14 +712,11 @@ impl<T> WrappedBody<T> {
     fn new(inner: T) -> Self {
         WrappedBody {
             inner,
-            errs: Vec::new()
+            errs: Vec::new(),
         }
     }
 
-    fn with_inner_mut<F>(&mut self, f: F)
-    where
-        F: FnOnce(&mut T) -> Result<(), Error>
-    {
+    fn with_inner_mut(&mut self, f: impl FnOnce(&mut T) -> Result<(), Error>) {
         if let Err(e) = f(&mut self.inner) {
             self.errs.push(e);
         }
@@ -708,8 +725,7 @@ impl<T> WrappedBody<T> {
     fn try_into_inner(self) -> Result<T, Error> {
         if self.errs.len() > 0 {
             Err(error::request(BulkBodyError(self.errs)))
-        }
-        else {
+        } else {
             Ok(self.inner)
         }
     }
@@ -765,11 +781,16 @@ pub trait BulkBody {
     If the document can't be serialized then this method will return an error.
     There's no guarantee that other operations can be pushed onto the body after an error has occurred.
     */
-    fn push<TDocument>(&mut self, op: BulkOperation<TDocument>) -> Result<(), Error> where TDocument: Serialize;
+    fn push<TDocument>(&mut self, op: BulkOperation<TDocument>) -> Result<(), Error>
+    where
+        TDocument: Serialize;
 }
 
 impl BulkBody for Vec<u8> {
-    fn push<TDocument>(&mut self, op: BulkOperation<TDocument>) -> Result<(), Error> where TDocument: Serialize {
+    fn push<TDocument>(&mut self, op: BulkOperation<TDocument>) -> Result<(), Error>
+    where
+        TDocument: Serialize,
+    {
         op.write(self).map_err(error::request)?;
 
         Ok(())
@@ -802,18 +823,24 @@ impl<TResponse> Future for Pending<TResponse> {
 }
 
 #[doc(hidden)]
-pub trait ChangeIndex<TIndex> { type WithNewIndex; }
+pub trait ChangeIndex<TIndex> {
+    type WithNewIndex;
+}
 
 impl<TIndex, TType, TId, TNewIndex> ChangeIndex<TNewIndex> for BulkResponse<TIndex, TType, TId> {
     type WithNewIndex = BulkResponse<TNewIndex, TType, TId>;
 }
 
-impl<TIndex, TType, TId, TNewIndex> ChangeIndex<TNewIndex> for BulkErrorsResponse<TIndex, TType, TId> {
+impl<TIndex, TType, TId, TNewIndex> ChangeIndex<TNewIndex>
+    for BulkErrorsResponse<TIndex, TType, TId>
+{
     type WithNewIndex = BulkErrorsResponse<TNewIndex, TType, TId>;
 }
 
 #[doc(hidden)]
-pub trait ChangeType<TType> { type WithNewType; }
+pub trait ChangeType<TType> {
+    type WithNewType;
+}
 
 impl<TIndex, TType, TId, TNewType> ChangeType<TNewType> for BulkResponse<TIndex, TType, TId> {
     type WithNewType = BulkResponse<TIndex, TNewType, TId>;
@@ -824,7 +851,9 @@ impl<TIndex, TType, TId, TNewType> ChangeType<TNewType> for BulkErrorsResponse<T
 }
 
 #[doc(hidden)]
-pub trait ChangeId<TId> { type WithNewId; }
+pub trait ChangeId<TId> {
+    type WithNewId;
+}
 
 impl<TIndex, TType, TId, TNewId> ChangeId<TNewId> for BulkResponse<TIndex, TType, TId> {
     type WithNewId = BulkResponse<TIndex, TType, TNewId>;
@@ -836,18 +865,13 @@ impl<TIndex, TType, TId, TNewId> ChangeId<TNewId> for BulkErrorsResponse<TIndex,
 
 #[cfg(test)]
 mod tests {
-    use serde_json::{self, Value};
     use prelude::*;
 
     #[test]
     fn default_request() {
         let client = SyncClientBuilder::new().build().unwrap();
 
-        let req = client
-            .bulk()
-            .inner
-            .into_request()
-            .unwrap();
+        let req = client.bulk().inner.into_request().unwrap();
 
         assert_eq!("/_bulk", req.url.as_ref());
     }
@@ -885,11 +909,7 @@ mod tests {
     fn specify_ty_without_index() {
         let client = SyncClientBuilder::new().build().unwrap();
 
-        let req = client
-            .bulk()
-            .ty("new-ty")
-            .inner
-            .into_request();
+        let req = client.bulk().ty("new-ty").inner.into_request();
 
         assert!(req.is_err());
     }
diff --git a/src/elastic/src/client/requests/bulk/operation.rs b/src/elastic/src/client/requests/bulk/operation.rs
index 36b51221fb..9540bc0a24 100644
--- a/src/elastic/src/client/requests/bulk/operation.rs
+++ b/src/elastic/src/client/requests/bulk/operation.rs
@@ -1,12 +1,28 @@
-use std::io::{self, Write};
-use std::ops::Deref;
+use std::io::{
+    self,
+    Write,
+};
 use std::marker::PhantomData;
+use std::ops::Deref;
 
-use serde::ser::{Serialize, Serializer, SerializeMap};
+use serde::ser::{
+    Serialize,
+    SerializeMap,
+    Serializer,
+};
 use serde_json;
 
-use client::requests::params::{Index, Type, Id};
-use client::requests::common::{Doc, Script, ScriptBuilder, DefaultParams};
+use client::requests::common::{
+    DefaultParams,
+    Doc,
+    Script,
+    ScriptBuilder,
+};
+use client::requests::params::{
+    Id,
+    Index,
+    Type,
+};
 use types::document::DocumentType;
 
 pub use client::responses::bulk::Action;
@@ -22,11 +38,23 @@ pub struct BulkOperation<TValue> {
 
 #[derive(Serialize)]
 struct BulkHeader {
-    #[serde(rename = "_index", serialize_with = "serialize_param", skip_serializing_if = "Option::is_none")]
+    #[serde(
+        rename = "_index",
+        serialize_with = "serialize_param",
+        skip_serializing_if = "Option::is_none"
+    )]
     index: Option<Index<'static>>,
-    #[serde(rename = "_type", serialize_with = "serialize_param", skip_serializing_if = "Option::is_none")]
+    #[serde(
+        rename = "_type",
+        serialize_with = "serialize_param",
+        skip_serializing_if = "Option::is_none"
+    )]
     ty: Option<Type<'static>>,
-    #[serde(rename = "_id", serialize_with = "serialize_param", skip_serializing_if = "Option::is_none")]
+    #[serde(
+        rename = "_id",
+        serialize_with = "serialize_param",
+        skip_serializing_if = "Option::is_none"
+    )]
     id: Option<Id<'static>>,
 }
 
@@ -42,11 +70,16 @@ impl<TParams> BulkOperation<Script<TParams>> {
     /**
     Set the script for this bulk operation.
     */
-    pub fn script_fluent<TBuilder, TNewParams>(self, builder: TBuilder) -> BulkOperation<Script<TNewParams>>
+    pub fn script_fluent<TBuilder, TNewParams>(
+        self,
+        builder: TBuilder,
+    ) -> BulkOperation<Script<TNewParams>>
     where
         TBuilder: Fn(ScriptBuilder<TParams>) -> ScriptBuilder<TNewParams>,
     {
-        let inner = self.inner.map(|script| builder(ScriptBuilder::from_script(script)).build());
+        let inner = self
+            .inner
+            .map(|script| builder(ScriptBuilder::from_script(script)).build());
 
         BulkOperation {
             action: self.action,
@@ -60,10 +93,7 @@ impl<TValue> BulkOperation<TValue> {
     /**
     Set the index for this bulk operation.
     */
-    pub fn index<I>(mut self, index: I) -> Self
-    where
-        I: Into<Index<'static>>,
-    {
+    pub fn index(mut self, index: impl Into<Index<'static>>) -> Self {
         self.header.index = Some(index.into());
         self
     }
@@ -71,10 +101,7 @@ impl<TValue> BulkOperation<TValue> {
     /**
     Set the type for this bulk operation.
     */
-    pub fn ty<I>(mut self, ty: I) -> Self
-    where
-        I: Into<Type<'static>>,
-    {
+    pub fn ty(mut self, ty: impl Into<Type<'static>>) -> Self {
         self.header.ty = Some(ty.into());
         self
     }
@@ -93,7 +120,7 @@ impl<TValue> BulkOperation<TValue> {
 
 impl<TDocument> BulkOperation<TDocument>
 where
-    TDocument: Serialize
+    TDocument: Serialize,
 {
     /**
     Write the operation to the given writer.
@@ -102,8 +129,8 @@ where
     This method will write a json header, then a newline, then the document body.
     */
     pub fn write<W>(&self, mut writer: W) -> io::Result<()>
-        where
-            W: Write,
+    where
+        W: Write,
     {
         struct Header<'a> {
             action: Action,
@@ -112,7 +139,8 @@ where
 
         impl<'a> Serialize for Header<'a> {
             fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
-                where S: Serializer
+            where
+                S: Serializer,
             {
                 let mut map = serializer.serialize_map(Some(1))?;
 
@@ -129,7 +157,13 @@ where
             }
         }
 
-        serde_json::to_writer(&mut writer, &Header { action: self.action, inner: &self.header })?;
+        serde_json::to_writer(
+            &mut writer,
+            &Header {
+                action: self.action,
+                inner: &self.header,
+            },
+        )?;
         write!(&mut writer, "\n")?;
 
         if let Some(ref inner) = self.inner {
@@ -179,7 +213,11 @@ where
         }
     }
 
-    pub fn update_script<TId, TScript>(self, id: TId, script: TScript) -> BulkOperation<Script<DefaultParams>>
+    pub fn update_script<TId, TScript>(
+        self,
+        id: TId,
+        script: TScript,
+    ) -> BulkOperation<Script<DefaultParams>>
     where
         TId: Into<Id<'static>>,
         TScript: ToString,
@@ -195,7 +233,12 @@ where
         }
     }
 
-    pub fn update_script_fluent<TId, TScript, TBuilder, TParams>(self, id: TId, script: TScript, builder: TBuilder) -> BulkOperation<Script<TParams>>
+    pub fn update_script_fluent<TId, TScript, TBuilder, TParams>(
+        self,
+        id: TId,
+        script: TScript,
+        builder: TBuilder,
+    ) -> BulkOperation<Script<TParams>>
     where
         TId: Into<Id<'static>>,
         TScript: ToString,
@@ -254,9 +297,7 @@ pub struct BulkRawOperation {
 
 impl BulkRawOperation {
     pub fn new() -> Self {
-        BulkRawOperation {
-            _private: (),
-        }
+        BulkRawOperation { _private: () }
     }
 
     pub fn index<TDocument>(self, doc: TDocument) -> BulkOperation<Doc<TDocument>> {
@@ -298,7 +339,11 @@ impl BulkRawOperation {
         }
     }
 
-    pub fn update_script_fluent<TId, TScript, TBuilder, TParams>(self, script: TScript, builder: TBuilder) -> BulkOperation<Script<TParams>>
+    pub fn update_script_fluent<TId, TScript, TBuilder, TParams>(
+        self,
+        script: TScript,
+        builder: TBuilder,
+    ) -> BulkOperation<Script<TParams>>
     where
         TScript: ToString,
         TBuilder: Fn(ScriptBuilder<DefaultParams>) -> ScriptBuilder<TParams>,
diff --git a/src/elastic/src/client/requests/bulk/stream.rs b/src/elastic/src/client/requests/bulk/stream.rs
index 174ef14722..9c302855da 100644
--- a/src/elastic/src/client/requests/bulk/stream.rs
+++ b/src/elastic/src/client/requests/bulk/stream.rs
@@ -1,24 +1,59 @@
-use std::{mem, fmt};
-use std::io;
-use std::time::Duration;
 use std::error::Error as StdError;
+use std::io;
 use std::marker::PhantomData;
-
-use bytes::{BufMut, BytesMut};
-use futures::{Future, Poll, Async, AsyncSink, Sink, Stream};
+use std::time::{
+    Duration,
+    Instant,
+};
+use std::{
+    fmt,
+    mem,
+};
+
+use bytes::{
+    BufMut,
+    BytesMut,
+};
+use channel::{
+    self,
+    TryRecvError,
+    TrySendError,
+};
 use fluent_builder::FluentBuilder;
-use tokio_timer::{Timer, Sleep};
-use channel::{self, TrySendError, TryRecvError};
-use serde::ser::Serialize;
+use futures::{
+    Async,
+    AsyncSink,
+    Future,
+    Poll,
+    Sink,
+    Stream,
+};
 use serde::de::DeserializeOwned;
-
-use error::{self, Error};
-use client::{Client, RequestParams};
-use client::sender::AsyncSender;
+use serde::ser::Serialize;
+use tokio::timer::Delay;
+
+use super::{
+    BulkOperation,
+    BulkRequestBuilder,
+    BulkRequestInner,
+    Pending,
+    WrappedBody,
+};
+use client::requests::params::{
+    Index,
+    Type,
+};
 use client::requests::RequestBuilder;
-use client::requests::params::{Index, Type};
 use client::responses::parse::IsOk;
-use super::{BulkRequestBuilder, BulkRequestInner, Pending, BulkOperation, WrappedBody};
+use client::sender::AsyncSender;
+use client::{
+    Client,
+    RequestParams,
+};
+use error::{
+    self,
+    Error,
+};
 
 /**
 The sending half of a stream of bulk operations.
@@ -35,7 +70,11 @@ pub struct BulkSender<TDocument, TResponse> {
 }
 
 impl<TDocument, TResponse> BulkSender<TDocument, TResponse> {
-    pub(super) fn new(req_template: SenderRequestTemplate<TResponse>, timeout: Timeout, body: SenderBody) -> (Self, BulkReceiver<TResponse>) {
+    pub(super) fn new(
+        req_template: SenderRequestTemplate<TResponse>,
+        timeout: Timeout,
+        body: SenderBody,
+    ) -> (Self, BulkReceiver<TResponse>) {
         let (tx, rx) = channel::bounded(1);
 
         let sender = BulkSender {
@@ -47,7 +86,12 @@ impl<TDocument, TResponse> BulkSender<TDocument, TResponse> {
             _marker: PhantomData,
         };
 
-        (sender, BulkReceiver { rx: BulkReceiverInner(rx) })
+        (
+            sender,
+            BulkReceiver {
+                rx: BulkReceiverInner(rx),
+            },
+        )
     }
 }
 
@@ -60,7 +104,12 @@ pub(super) struct SenderRequestTemplate<TResponse> {
 }
 
 impl<TResponse> SenderRequestTemplate<TResponse> {
-    pub(super) fn new(client: Client<AsyncSender>, params: RequestParams, index: Option<Index<'static>>, ty: Option<Type<'static>>) -> Self {
+    pub(super) fn new(
+        client: Client<AsyncSender>,
+        params: RequestParams,
+        index: Option<Index<'static>>,
+        ty: Option<Type<'static>>,
+    ) -> Self {
         SenderRequestTemplate {
             client,
             params,
@@ -79,31 +128,25 @@ impl<TResponse> SenderRequestTemplate<TResponse> {
                 ty: self.ty.clone(),
                 body: WrappedBody::new(body),
                 _marker: PhantomData,
-            }
+            },
         )
     }
 }
 
 pub(super) struct Timeout {
-    timer: Timer,
     duration: Duration,
-    sleep: Sleep,
+    delay: Delay,
 }
 
 impl Timeout {
     pub(super) fn new(duration: Duration) -> Self {
-        let timer = Timer::default();
-        let sleep = timer.sleep(duration);
+        let delay = Delay::new(Instant::now() + duration);
 
-        Timeout {
-            duration,
-            timer,
-            sleep
-        }
+        Timeout { duration, delay }
     }
 
     fn restart(&mut self) {
-        self.sleep = self.timer.sleep(self.duration);
+        self.delay.reset(Instant::now() + self.duration);
     }
 }
 
@@ -112,7 +155,7 @@ impl Future for Timeout {
     type Error = Error;
 
     fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
-        self.sleep.poll().map_err(error::request)
+        self.delay.poll().map_err(error::request)
     }
 }
 
@@ -137,7 +180,7 @@ The receiving half of a stream of bulk operations.
 The receiver emits complete bulk responses.
 */
 pub struct BulkReceiver<TResponse> {
-    rx: BulkReceiverInner<TResponse>
+    rx: BulkReceiverInner<TResponse>,
 }
 
 pub(super) struct SenderBody {
@@ -217,15 +260,18 @@ where
     type SinkItem = BulkOperation<TDocument>;
     type SinkError = Error;
 
-    fn start_send(&mut self, item: Self::SinkItem) -> Result<AsyncSink<Self::SinkItem>, Self::SinkError> {
+    fn start_send(
+        &mut self,
+        item: Self::SinkItem,
+    ) -> Result<AsyncSink<Self::SinkItem>, Self::SinkError> {
         match self.timeout.poll() {
             // Only respect the timeout if the body is not empty
             Ok(Async::Ready(())) if !self.body.is_empty() => {
                 return match self.poll_complete() {
                     Ok(_) => Ok(AsyncSink::NotReady(item)),
-                    Err(e) => Err(e)
-                }
-            },
+                    Err(e) => Err(e),
+                };
+            }
             // Continue
             Ok(Async::Ready(_)) | Ok(Async::NotReady) => (),
             Err(e) => return Err(error::request(e)),
@@ -234,11 +280,10 @@ where
         if self.body.has_capacity() {
             self.body.push(item).map_err(error::request)?;
             Ok(AsyncSink::Ready)
-        }
-        else {
+        } else {
             match self.poll_complete() {
                 Ok(_) => Ok(AsyncSink::NotReady(item)),
-                Err(e) => Err(e)
+                Err(e) => Err(e),
             }
         }
     }
@@ -249,7 +294,9 @@ where
             BulkSenderInFlight::ReadyToSend => {
                 match self.timeout.poll() {
                     // If the timeout hasn't expired and the body isn't full then we're not ready
-                    Ok(Async::NotReady) if !self.body.is_full() && !self.body.is_empty() => return Ok(Async::NotReady),
+                    Ok(Async::NotReady) if !self.body.is_full() && !self.body.is_empty() => {
+                        return Ok(Async::NotReady);
+                    }
                     // Continue
                     Ok(Async::NotReady) => (),
                     // Restart the expired timer
@@ -258,7 +305,7 @@ where
                 }
 
                 if self.body.is_empty() {
-                    return Ok(Async::Ready(()))
+                    return Ok(Async::Ready(()));
                 }
 
                 let body = self.body.take();
@@ -280,12 +327,11 @@ where
                         Ok(AsyncSink::Ready) => BulkSenderInFlight::Transmitted,
                         Ok(AsyncSink::NotReady(item)) => {
                             *response = Some(item);
-                            return Ok(Async::NotReady)
-                        },
-                        Err(e) => return Err(e)
+                            return Ok(Async::NotReady);
+                        }
+                        Err(e) => return Err(e),
                     }
-                }
-                else {
+                } else {
                     BulkSenderInFlight::Transmitted
                 }
             }
@@ -313,13 +359,18 @@ where
     type SinkItem = T;
     type SinkError = Error;
 
-    fn start_send(&mut self, item: Self::SinkItem) -> Result<AsyncSink<Self::SinkItem>, Self::SinkError> {
-        self.0.as_ref().map(|tx| match tx.try_send(item) {
-            Ok(()) => Ok(AsyncSink::Ready),
-            Err(TrySendError::Full(item)) => Ok(AsyncSink::NotReady(item)),
-            Err(TrySendError::Disconnected(_)) => Err(error::request(Disconnected)),
-        })
-        .unwrap_or(Err(error::request(Disconnected)))
+    fn start_send(
+        &mut self,
+        item: Self::SinkItem,
+    ) -> Result<AsyncSink<Self::SinkItem>, Self::SinkError> {
+        self.0
+            .as_ref()
+            .map(|tx| match tx.try_send(item) {
+                Ok(()) => Ok(AsyncSink::Ready),
+                Err(TrySendError::Full(item)) => Ok(AsyncSink::NotReady(item)),
+                Err(TrySendError::Disconnected(_)) => Err(error::request(Disconnected)),
+            })
+            .unwrap_or(Err(error::request(Disconnected)))
     }
 
     fn poll_complete(&mut self) -> Poll<(), Self::SinkError> {
@@ -334,7 +385,7 @@ where
 
 impl<TResponse> Stream for BulkReceiver<TResponse>
 where
-    TResponse: Send
+    TResponse: Send,
 {
     type Item = TResponse;
     type Error = Error;
@@ -346,7 +397,7 @@ where
 
 impl<T> Stream for BulkReceiverInner<T>
 where
-    T: Send
+    T: Send,
 {
     type Item = T;
     type Error = Error;
diff --git a/src/elastic/src/client/requests/common.rs b/src/elastic/src/client/requests/common.rs
index 4d9dfa5762..16c1cb1b25 100644
--- a/src/elastic/src/client/requests/common.rs
+++ b/src/elastic/src/client/requests/common.rs
@@ -2,8 +2,14 @@
 Types that are common between requests.
 */
 
-use serde::ser::{Serialize, Serializer};
-use serde_json::{Value, Map};
+use serde::ser::{
+    Serialize,
+    Serializer,
+};
+use serde_json::{
+    Map,
+    Value,
+};
 
 /** Update an indexed document using a new document. */
 #[derive(Serialize)]
@@ -56,8 +62,8 @@ pub struct Script<TParams> {
 impl Script<DefaultParams> {
     /** Create a new script builder using the given source. */
     pub(crate) fn new<TScript>(source: TScript) -> Self
-        where
-            TScript: ToString,
+    where
+        TScript: ToString,
     {
         ScriptBuilder::new(source).build()
     }
@@ -65,9 +71,12 @@ impl Script<DefaultParams> {
 
 #[derive(Serialize)]
 struct ScriptInner<TParams> {
-    #[serde(rename = "inline")] source: String,
-    #[serde(skip_serializing_if = "Option::is_none")] lang: Option<String>,
-    #[serde(skip_serializing_if = "Option::is_none")] params: Option<TParams>,
+    #[serde(rename = "inline")]
+    source: String,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    lang: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    params: Option<TParams>,
 }
 
 /** A builder for an update script that can be configured before sending. */
@@ -154,4 +163,4 @@ impl<'a> From<&'a str> for ScriptBuilder<DefaultParams> {
     fn from(source: &'a str) -> Self {
         ScriptBuilder::new(source)
     }
-}
\ No newline at end of file
+}
diff --git a/src/elastic/src/client/requests/document_delete.rs b/src/elastic/src/client/requests/document_delete.rs
index b8e85b12a2..d7846fc22b 100644
--- a/src/elastic/src/client/requests/document_delete.rs
+++ b/src/elastic/src/client/requests/document_delete.rs
@@ -4,21 +4,39 @@ Builders for [delete document requests][docs-delete].
 [docs-delete]: http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html
 */
 
+use futures::{
+    Future,
+    Poll,
+};
 use std::marker::PhantomData;
-use futures::{Future, Poll};
 
-use error::{Error, Result};
-use client::DocumentClient;
-use client::sender::{AsyncSender, Sender, SyncSender};
-use client::requests::RequestBuilder;
-use client::requests::params::{Id, Index, Type};
 use client::requests::endpoints::DeleteRequest;
+use client::requests::params::{
+    Id,
+    Index,
+    Type,
+};
 use client::requests::raw::RawRequestInner;
+use client::requests::RequestBuilder;
 use client::responses::DeleteResponse;
+use client::sender::{
+    AsyncSender,
+    Sender,
+    SyncSender,
+};
+use client::DocumentClient;
+use error::{
+    Error,
+    Result,
+};
+use types::document::{
+    DocumentType,
+    StaticIndex,
+    StaticType,
+};
 use types::DEFAULT_TYPE;
-use types::document::{DocumentType, StaticIndex, StaticType};
 
-/** 
+/**
 A [delete document request][docs-delete] builder that can be configured before sending.
 
 Call [`Client.document_delete`][Client.document_delete] to get a `DeleteRequestBuilder`.
@@ -29,7 +47,8 @@ The `send` method will either send the request [synchronously][send-sync] or [as
 [send-async]: #send-asynchronously
 [Client.document_delete]: ../../struct.Client.html#delete-document
 */
-pub type DeleteRequestBuilder<TSender, TDocument> = RequestBuilder<TSender, DeleteRequestInner<TDocument>>;
+pub type DeleteRequestBuilder<TSender, TDocument> =
+    RequestBuilder<TSender, DeleteRequestInner<TDocument>>;
 
 #[doc(hidden)]
 pub struct DeleteRequestInner<TDocument> {
@@ -46,7 +65,7 @@ impl<TSender, TDocument> DocumentClient<TSender, TDocument>
 where
     TSender: Sender,
 {
-    /** 
+    /**
     Create a [`DeleteRequestBuilder`][DeleteRequestBuilder] with this `Client` that can be configured before sending.
 
     For more details, see:
@@ -58,7 +77,7 @@ where
     # Examples
 
     Delete a [`DocumentType`][documents-mod] called `MyType` with an id of `1`:
-    
+
     ```no_run
     # extern crate serde;
     # #[macro_use]
@@ -91,9 +110,8 @@ where
     [send-async]: requests/document_delete/type.DeleteRequestBuilder.html#send-asynchronously
     [documents-mod]: ../types/document/index.html
     */
-    pub fn delete<TId>(self, id: TId) -> DeleteRequestBuilder<TSender, TDocument>
+    pub fn delete(self, id: impl Into<Id<'static>>) -> DeleteRequestBuilder<TSender, TDocument>
     where
-        TId: Into<Id<'static>>,
         TDocument: DocumentType + StaticIndex + StaticType,
     {
         let index = TDocument::static_index().into();
@@ -115,7 +133,7 @@ impl<TSender> DocumentClient<TSender, ()>
 where
     TSender: Sender,
 {
-    /** 
+    /**
     Create a [`DeleteRequestBuilder`][DeleteRequestBuilder] with this `Client` that can be configured before sending.
 
     For more details, see:
@@ -127,7 +145,7 @@ where
     # Examples
 
     Delete a [`DocumentType`][documents-mod] called `MyType` with an id of `1`:
-    
+
     ```no_run
     # extern crate serde;
     # #[macro_use]
@@ -154,11 +172,11 @@ where
     [send-async]: requests/document_delete/type.DeleteRequestBuilder.html#send-asynchronously
     [documents-mod]: ../types/document/index.html
     */
-    pub fn delete_raw<TIndex, TId>(self, index: TIndex, id: TId) -> DeleteRequestBuilder<TSender, ()>
-    where
-        TIndex: Into<Index<'static>>,
-        TId: Into<Id<'static>>,
-    {
+    pub fn delete_raw(
+        self,
+        index: impl Into<Index<'static>>,
+        id: impl Into<Id<'static>>,
+    ) -> DeleteRequestBuilder<TSender, ()> {
         RequestBuilder::initial(
             self.inner,
             DeleteRequestInner {
@@ -187,19 +205,13 @@ where
     TSender: Sender,
 {
     /** Set the index for the delete request. */
-    pub fn index<I>(mut self, index: I) -> Self
-    where
-        I: Into<Index<'static>>,
-    {
+    pub fn index(mut self, index: impl Into<Index<'static>>) -> Self {
         self.inner.index = index.into();
         self
     }
 
     /** Set the type for the delete request. */
-    pub fn ty<I>(mut self, ty: I) -> Self
-    where
-        I: Into<Type<'static>>,
-    {
+    pub fn ty(mut self, ty: impl Into<Type<'static>>) -> Self {
         self.inner.ty = ty.into();
         self
     }
@@ -262,7 +274,7 @@ impl<TDocument> DeleteRequestBuilder<SyncSender, TDocument> {
 impl<TDocument> DeleteRequestBuilder<AsyncSender, TDocument> {
     /**
     Send a `DeleteRequestBuilder` asynchronously using an [`AsyncClient`][AsyncClient].
-    
+
     This will return a future that will resolve to the deserialised delete document response.
 
     # Examples
@@ -271,7 +283,7 @@ impl<TDocument> DeleteRequestBuilder<AsyncSender, TDocument> {
 
     ```no_run
     # extern crate futures;
-    # extern crate tokio_core;
+    # extern crate tokio;
     # extern crate serde;
     # extern crate serde_json;
     # #[macro_use] extern crate serde_derive;
@@ -284,13 +296,12 @@ impl<TDocument> DeleteRequestBuilder<AsyncSender, TDocument> {
     # struct MyType { }
     # fn main() { run().unwrap() }
     # fn run() -> Result<(), Box<::std::error::Error>> {
-    # let core = tokio_core::reactor::Core::new()?;
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     let future = client.document::<MyType>()
                        .delete(1)
                        .ty("mytype")
                        .send();
-    
+
     future.and_then(|response| {
         assert!(response.deleted());
 
@@ -306,9 +317,10 @@ impl<TDocument> DeleteRequestBuilder<AsyncSender, TDocument> {
     pub fn send(self) -> Pending {
         let req = self.inner.into_request();
 
-        let res_future = RequestBuilder::new(self.client, self.params_builder, RawRequestInner::new(req))
-            .send()
-            .and_then(|res| res.into_response());
+        let res_future =
+            RequestBuilder::new(self.client, self.params_builder, RawRequestInner::new(req))
+                .send()
+                .and_then(|res| res.into_response());
 
         Pending::new(res_future)
     }
@@ -344,7 +356,7 @@ mod tests {
     use prelude::*;
 
     #[derive(ElasticType)]
-    struct TestDoc { }
+    struct TestDoc {}
 
     #[test]
     fn default_request() {
diff --git a/src/elastic/src/client/requests/document_get.rs b/src/elastic/src/client/requests/document_get.rs
index 39b12cfaf1..d5a2e54852 100644
--- a/src/elastic/src/client/requests/document_get.rs
+++ b/src/elastic/src/client/requests/document_get.rs
@@ -4,22 +4,40 @@ Builders for [get document requests][docs-get].
 [docs-get]: http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html
 */
 
-use std::marker::PhantomData;
-use futures::{Future, Poll};
+use futures::{
+    Future,
+    Poll,
+};
 use serde::de::DeserializeOwned;
+use std::marker::PhantomData;
 
-use error::{Error, Result};
-use client::DocumentClient;
-use client::sender::{AsyncSender, Sender, SyncSender};
-use client::requests::RequestBuilder;
-use client::requests::params::{Id, Index, Type};
 use client::requests::endpoints::GetRequest;
+use client::requests::params::{
+    Id,
+    Index,
+    Type,
+};
 use client::requests::raw::RawRequestInner;
+use client::requests::RequestBuilder;
 use client::responses::GetResponse;
+use client::sender::{
+    AsyncSender,
+    Sender,
+    SyncSender,
+};
+use client::DocumentClient;
+use error::{
+    Error,
+    Result,
+};
+use types::document::{
+    DocumentType,
+    StaticIndex,
+    StaticType,
+};
 use types::DEFAULT_TYPE;
-use types::document::{DocumentType, StaticIndex, StaticType};
 
-/** 
+/**
 A [get document request][docs-get] builder that can be configured before sending.
 
 Call [`Client.document_get`][Client.document_get] to get a `GetRequestBuilder`.
@@ -30,7 +48,8 @@ The `send` method will either send the request [synchronously][send-sync] or [as
 [send-async]: #send-asynchronously
 [Client.document_get]: ../../struct.Client.html#get-document
 */
-pub type GetRequestBuilder<TSender, TDocument> = RequestBuilder<TSender, GetRequestInner<TDocument>>;
+pub type GetRequestBuilder<TSender, TDocument> =
+    RequestBuilder<TSender, GetRequestInner<TDocument>>;
 
 #[doc(hidden)]
 pub struct GetRequestInner<TDocument> {
@@ -47,7 +66,7 @@ impl<TSender, TDocument> DocumentClient<TSender, TDocument>
 where
     TSender: Sender,
 {
-    /** 
+    /**
     Create a [`GetRequestBuilder`][GetRequestBuilder] with this `Client` that can be configured before sending.
 
     For more details, see:
@@ -59,7 +78,7 @@ where
     # Examples
 
     Get a [`DocumentType`][documents-mod] called `MyType` with an id of `1`:
-    
+
     ```no_run
     # extern crate serde;
     # extern crate serde_json;
@@ -89,9 +108,8 @@ where
     [types-mod]: ../types/index.html
     [documents-mod]: ../types/document/index.html
     */
-    pub fn get<TId>(self, id: TId) -> GetRequestBuilder<TSender, TDocument>
+    pub fn get(self, id: impl Into<Id<'static>>) -> GetRequestBuilder<TSender, TDocument>
     where
-        TId: Into<Id<'static>>,
         TDocument: DeserializeOwned + DocumentType + StaticIndex + StaticType,
     {
         let index = TDocument::static_index().into();
@@ -108,7 +126,7 @@ where
         )
     }
 
-    /** 
+    /**
     Create a [`GetRequestBuilder`][GetRequestBuilder] with this `Client` that can be configured before sending.
 
     For more details, see:
@@ -146,10 +164,12 @@ where
     [types-mod]: ../types/index.html
     [documents-mod]: ../types/document/index.html
     */
-    pub fn get_raw<TIndex, TId>(self, index: TIndex, id: TId) -> GetRequestBuilder<TSender, TDocument>
+    pub fn get_raw(
+        self,
+        index: impl Into<Index<'static>>,
+        id: impl Into<Id<'static>>,
+    ) -> GetRequestBuilder<TSender, TDocument>
     where
-        TIndex: Into<Index<'static>>,
-        TId: Into<Id<'static>>,
         TDocument: DeserializeOwned,
     {
         RequestBuilder::initial(
@@ -180,19 +200,13 @@ where
     TSender: Sender,
 {
     /** Set the index for the get request. */
-    pub fn index<I>(mut self, index: I) -> Self
-    where
-        I: Into<Index<'static>>,
-    {
+    pub fn index(mut self, index: impl Into<Index<'static>>) -> Self {
         self.inner.index = index.into();
         self
     }
 
     /** Set the type for the get request. */
-    pub fn ty<I>(mut self, ty: I) -> Self
-    where
-        I: Into<Type<'static>>,
-    {
+    pub fn ty(mut self, ty: impl Into<Type<'static>>) -> Self {
         self.inner.ty = ty.into();
         self
     }
@@ -230,7 +244,7 @@ where
     let response = client.document::<MyType>()
                          .get(1)
                          .send()?;
-    
+
     if let Some(doc) = response.into_document() {
         println!("{:?}", doc);
     }
@@ -259,7 +273,7 @@ where
 {
     /**
     Send a `GetRequestBuilder` asynchronously using an [`AsyncClient`][AsyncClient].
-    
+
     This will return a future that will resolve to the deserialised get document response.
 
     # Examples
@@ -268,7 +282,7 @@ where
 
     ```no_run
     # extern crate futures;
-    # extern crate tokio_core;
+    # extern crate tokio;
     # extern crate serde;
     # extern crate serde_json;
     # #[macro_use] extern crate serde_derive;
@@ -281,12 +295,11 @@ where
     # struct MyType { }
     # fn main() { run().unwrap() }
     # fn run() -> Result<(), Box<::std::error::Error>> {
-    # let core = tokio_core::reactor::Core::new()?;
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     let future = client.document::<MyType>()
                        .get(1)
                        .send();
-    
+
     future.and_then(|response| {
         if let Some(doc) = response.into_document() {
             println!("{:?}", doc);
@@ -304,9 +317,10 @@ where
     pub fn send(self) -> Pending<TDocument> {
         let req = self.inner.into_request();
 
-        let res_future = RequestBuilder::new(self.client, self.params_builder, RawRequestInner::new(req))
-            .send()
-            .and_then(|res| res.into_response());
+        let res_future =
+            RequestBuilder::new(self.client, self.params_builder, RawRequestInner::new(req))
+                .send()
+                .and_then(|res| res.into_response());
 
         Pending::new(res_future)
     }
@@ -345,17 +359,13 @@ mod tests {
     use prelude::*;
 
     #[derive(Deserialize, ElasticType)]
-    struct TestDoc { }
+    struct TestDoc {}
 
     #[test]
     fn default_request() {
         let client = SyncClientBuilder::new().build().unwrap();
 
-        let req = client
-            .document::<TestDoc>()
-            .get("1")
-            .inner
-            .into_request();
+        let req = client.document::<TestDoc>().get("1").inner.into_request();
 
         assert_eq!("/testdoc/doc/1", req.url.as_ref());
     }
diff --git a/src/elastic/src/client/requests/document_index.rs b/src/elastic/src/client/requests/document_index.rs
index dfba95fadf..e784f104aa 100644
--- a/src/elastic/src/client/requests/document_index.rs
+++ b/src/elastic/src/client/requests/document_index.rs
@@ -6,25 +6,40 @@ Builders for [index requests][docs-index].
 
 use std::borrow::Cow;
 
-use serde_json;
-use futures::{Future, Poll};
+use futures::{
+    Future,
+    Poll,
+};
 use serde::Serialize;
+use serde_json;
 
-use error::{self, Error, Result};
-use client::DocumentClient;
-use client::sender::{AsyncSender, Sender, SyncSender};
-use client::requests::RequestBuilder;
-use client::requests::params::{Id, Index, Type};
 use client::requests::endpoints::IndexRequest;
+use client::requests::params::{
+    Id,
+    Index,
+    Type,
+};
 use client::requests::raw::RawRequestInner;
+use client::requests::RequestBuilder;
 use client::responses::IndexResponse;
-use types::DEFAULT_TYPE;
+use client::sender::{
+    AsyncSender,
+    Sender,
+    SyncSender,
+};
+use client::DocumentClient;
+use error::{
+    self,
+    Error,
+    Result,
+};
 use types::document::DocumentType;
+use types::DEFAULT_TYPE;
 
-/** 
+/**
 An [index request][docs-index] builder that can be configured before sending.
 
-Call [`Client.document_index`][Client.document_index] to get an `IndexRequest`. 
+Call [`Client.document_index`][Client.document_index] to get an `IndexRequest`.
 The `send` method will either send the request [synchronously][send-sync] or [asynchronously][send-async], depending on the `Client` it was created from.
 
 [docs-index]: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html
@@ -32,7 +47,8 @@ The `send` method will either send the request [synchronously][send-sync] or [as
 [send-async]: #send-asynchronously
 [Client.document_index]: ../../struct.Client.html#index-document
 */
-pub type IndexRequestBuilder<TSender, TDocument> = RequestBuilder<TSender, IndexRequestInner<TDocument>>;
+pub type IndexRequestBuilder<TSender, TDocument> =
+    RequestBuilder<TSender, IndexRequestInner<TDocument>>;
 
 #[doc(hidden)]
 pub struct IndexRequestInner<TDocument> {
@@ -88,14 +104,14 @@ where
     let response = client.document()
                          .index(doc)
                          .send()?;
-    
+
     assert!(response.created());
     # Ok(())
     # }
     ```
 
     For more details on document types and mapping, see the [`types`][types-mod] module.
-    
+
     [IndexRequestBuilder]: requests/document_index/type.IndexRequestBuilder.html
     [builder-methods]: requests/document_index/type.IndexRequestBuilder.html#builder-methods
     [send-sync]: requests/document_index/type.IndexRequestBuilder.html#send-synchronously
@@ -103,7 +119,6 @@ where
     [types-mod]: ../types/index.html
     [documents-mod]: ../types/document/index.html
     */
-    // TODO: Consider `doc: impl AsRef<TDocument>`
     pub fn index(self, doc: TDocument) -> IndexRequestBuilder<TSender, TDocument>
     where
         TDocument: Serialize + DocumentType,
@@ -156,14 +171,14 @@ where
                          .index_raw("myindex", doc)
                          .id(doc_id)
                          .send()?;
-    
+
     assert!(response.created());
     # Ok(())
     # }
     ```
 
     For more details on document types and mapping, see the [`types`][types-mod] module.
-    
+
     [IndexRequestBuilder]: requests/document_index/type.IndexRequestBuilder.html
     [builder-methods]: requests/document_index/type.IndexRequestBuilder.html#builder-methods
     [send-sync]: requests/document_index/type.IndexRequestBuilder.html#send-synchronously
@@ -171,9 +186,12 @@ where
     [types-mod]: ../types/index.html
     [documents-mod]: ../types/document/index.html
     */
-    pub fn index_raw<TIndex>(self, index: TIndex, doc: TDocument) -> IndexRequestBuilder<TSender, TDocument>
+    pub fn index_raw(
+        self,
+        index: impl Into<Index<'static>>,
+        doc: TDocument,
+    ) -> IndexRequestBuilder<TSender, TDocument>
     where
-        TIndex: Into<Index<'static>>,
         TDocument: Serialize,
     {
         RequestBuilder::initial(
@@ -214,28 +232,19 @@ where
     TSender: Sender,
 {
     /** Set the index for the index request. */
-    pub fn index<I>(mut self, index: I) -> Self
-    where
-        I: Into<Index<'static>>,
-    {
+    pub fn index(mut self, index: impl Into<Index<'static>>) -> Self {
         self.inner.index = index.into();
         self
     }
 
     /** Set the type for the index request. */
-    pub fn ty<I>(mut self, ty: I) -> Self
-    where
-        I: Into<Type<'static>>,
-    {
+    pub fn ty(mut self, ty: impl Into<Type<'static>>) -> Self {
         self.inner.ty = ty.into();
         self
     }
 
     /** Set the id for the index request. */
-    pub fn id<I>(mut self, id: I) -> Self
-    where
-        I: Into<Id<'static>>
-    {
+    pub fn id(mut self, id: impl Into<Id<'static>>) -> Self {
         self.inner.id = Some(id.into());
         self
     }
@@ -281,7 +290,7 @@ where
     let response = client.document()
                          .index(doc)
                          .send()?;
-    
+
     assert!(response.created());
     # Ok(())
     # }
@@ -307,7 +316,7 @@ where
 {
     /**
     Send a `IndexRequestBuilder` asynchronously using an [`AsyncClient`][AsyncClient].
-    
+
     This will return a future that will resolve to the deserialised index response.
 
     # Examples
@@ -317,7 +326,7 @@ where
     ```no_run
     # extern crate serde;
     # extern crate futures;
-    # extern crate tokio_core;
+    # extern crate tokio;
     # #[macro_use] extern crate serde_derive;
     # #[macro_use] extern crate elastic_derive;
     # extern crate elastic;
@@ -331,8 +340,7 @@ where
     #     pub title: String,
     #     pub timestamp: Date<DefaultDateMapping>
     # }
-    # let core = tokio_core::reactor::Core::new()?;
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     let doc = MyType {
         id: "1".to_owned(),
         title: String::from("A title"),
@@ -342,7 +350,7 @@ where
     let future = client.document()
                        .index(doc)
                        .send();
-    
+
     future.and_then(|response| {
         assert!(response.created());
 
@@ -399,7 +407,7 @@ mod tests {
     use prelude::*;
 
     #[derive(Serialize, ElasticType)]
-    struct TestDoc { }
+    struct TestDoc {}
 
     #[test]
     fn default_request() {
diff --git a/src/elastic/src/client/requests/document_put_mapping.rs b/src/elastic/src/client/requests/document_put_mapping.rs
index 877b5d2a5c..0e6448a87e 100644
--- a/src/elastic/src/client/requests/document_put_mapping.rs
+++ b/src/elastic/src/client/requests/document_put_mapping.rs
@@ -4,24 +4,42 @@ Builders for [put mapping requests][docs-mapping].
 [docs-mapping]: https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html
 */
 
-use std::marker::PhantomData;
+use futures::{
+    Future,
+    Poll,
+};
 use serde_json;
-use futures::{Future, Poll};
+use std::marker::PhantomData;
 
-use error::{self, Error, Result};
-use client::DocumentClient;
-use client::sender::{AsyncSender, Sender, SyncSender};
-use client::requests::RequestBuilder;
-use client::requests::params::{Index, Type};
 use client::requests::endpoints::IndicesPutMappingRequest;
+use client::requests::params::{
+    Index,
+    Type,
+};
 use client::requests::raw::RawRequestInner;
+use client::requests::RequestBuilder;
 use client::responses::CommandResponse;
-use types::document::{DocumentType, StaticIndex, StaticType};
+use client::sender::{
+    AsyncSender,
+    Sender,
+    SyncSender,
+};
+use client::DocumentClient;
+use error::{
+    self,
+    Error,
+    Result,
+};
+use types::document::{
+    DocumentType,
+    StaticIndex,
+    StaticType,
+};
 
-/** 
+/**
 A [put mapping request][docs-mapping] builder that can be configured before sending.
 
-Call [`Client.document_put_mapping`][Client.document_put_mapping] to get a `PutMappingRequestBuilder`. 
+Call [`Client.document_put_mapping`][Client.document_put_mapping] to get a `PutMappingRequestBuilder`.
 The `send` method will either send the request [synchronously][send-sync] or [asynchronously][send-async], depending on the `Client` it was created from.
 
 [docs-mapping]: https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html
@@ -29,7 +47,8 @@ The `send` method will either send the request [synchronously][send-sync] or [as
 [send-async]: #send-asynchronously
 [Client.document_put_mapping]: ../../struct.Client.html#put-mapping-request
 */
-pub type PutMappingRequestBuilder<TSender, TDocument> = RequestBuilder<TSender, PutMappingRequestInner<TDocument>>;
+pub type PutMappingRequestBuilder<TSender, TDocument> =
+    RequestBuilder<TSender, PutMappingRequestInner<TDocument>>;
 
 #[doc(hidden)]
 pub struct PutMappingRequestInner<TDocument> {
@@ -45,7 +64,7 @@ impl<TSender, TDocument> DocumentClient<TSender, TDocument>
 where
     TSender: Sender,
 {
-    /** 
+    /**
     Create a [`PutMappingRequestBuilder`][PutMappingRequestBuilder] with this `Client` that can be configured before sending.
 
     For more details, see:
@@ -53,7 +72,7 @@ where
     - [builder methods][builder-methods]
     - [send synchronously][send-sync]
     - [send asynchronously][send-async]
-    
+
     # Examples
 
     Put the document mapping for a [`DocumentType`][documents-mod] called `MyType`:
@@ -113,14 +132,12 @@ where
         let body = serde_json::to_vec(&TDocument::index_mapping()).map_err(error::request)?;
 
         Ok(IndicesPutMappingRequest::for_index_ty(
-            self.index,
-            self.ty,
-            body,
+            self.index, self.ty, body,
         ))
     }
 }
 
-/** 
+/**
 # Builder methods
 
 Configure a `PutMappingRequestBuilder` before sending it.
@@ -130,19 +147,13 @@ where
     TSender: Sender,
 {
     /** Set the index for the put mapping request. */
-    pub fn index<I>(mut self, index: I) -> Self
-    where
-        I: Into<Index<'static>>,
-    {
+    pub fn index(mut self, index: impl Into<Index<'static>>) -> Self {
         self.inner.index = index.into();
         self
     }
 
     /** Set the type for the put mapping request. */
-    pub fn ty<I>(mut self, ty: I) -> Self
-    where
-        I: Into<Type<'static>>,
-    {
+    pub fn ty(mut self, ty: impl Into<Type<'static>>) -> Self {
         self.inner.ty = ty.into();
         self
     }
@@ -204,7 +215,7 @@ where
 {
     /**
     Send a `PutMappingRequestBuilder` asynchronously using an [`AsyncClient`][AsyncClient].
-    
+
     This will return a future that will resolve to the deserialised command response.
 
     # Examples
@@ -213,7 +224,7 @@ where
 
     ```no_run
     # extern crate futures;
-    # extern crate tokio_core;
+    # extern crate tokio;
     # extern crate serde;
     # #[macro_use] extern crate serde_derive;
     # #[macro_use] extern crate elastic_derive;
@@ -224,8 +235,7 @@ where
     # fn run() -> Result<(), Box<::std::error::Error>> {
     # #[derive(Serialize, Deserialize, ElasticType)]
     # struct MyType { }
-    # let core = tokio_core::reactor::Core::new()?;
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     let future = client.document::<MyType>()
                        .put_mapping()
                        .send();
@@ -283,11 +293,14 @@ impl Future for Pending {
 
 #[cfg(test)]
 mod tests {
-    use serde_json::{self, Value};
     use prelude::*;
+    use serde_json::{
+        self,
+        Value,
+    };
 
     #[derive(ElasticType)]
-    struct TestDoc { }
+    struct TestDoc {}
 
     #[test]
     fn default_request() {
diff --git a/src/elastic/src/client/requests/document_update.rs b/src/elastic/src/client/requests/document_update.rs
index a75ebf60e1..2c3c6b9b24 100644
--- a/src/elastic/src/client/requests/document_update.rs
+++ b/src/elastic/src/client/requests/document_update.rs
@@ -4,25 +4,48 @@ Builders for [update document requests][docs-update].
 [docs-update]: http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html
 */
 
-use std::marker::PhantomData;
-use futures::{Future, Poll};
-use serde_json;
+use futures::{
+    Future,
+    Poll,
+};
 use serde::ser::Serialize;
+use serde_json;
+use std::marker::PhantomData;
 
-use error::{self, Error};
-use client::DocumentClient;
-use client::sender::{AsyncSender, Sender, SyncSender};
-use client::requests::RequestBuilder;
-use client::requests::params::{Id, Index, Type};
 use client::requests::endpoints::UpdateRequest;
+use client::requests::params::{
+    Id,
+    Index,
+    Type,
+};
 use client::requests::raw::RawRequestInner;
+use client::requests::RequestBuilder;
 use client::responses::UpdateResponse;
+use client::sender::{
+    AsyncSender,
+    Sender,
+    SyncSender,
+};
+use client::DocumentClient;
+use error::{
+    self,
+    Error,
+};
+use types::document::{
+    DocumentType,
+    StaticIndex,
+    StaticType,
+};
 use types::DEFAULT_TYPE;
-use types::document::{DocumentType, StaticIndex, StaticType};
 
-pub use client::requests::common::{Doc, Script, ScriptBuilder, DefaultParams};
+pub use client::requests::common::{
+    DefaultParams,
+    Doc,
+    Script,
+    ScriptBuilder,
+};
 
-/** 
+/**
 An [update document request][docs-update] builder that can be configured before sending.
 
 Call [`Client.document_update`][Client.document_update] to get an `UpdateRequestBuilder`.
@@ -51,7 +74,7 @@ impl<TSender, TDocument> DocumentClient<TSender, TDocument>
 where
     TSender: Sender,
 {
-    /** 
+    /**
     Create an [`UpdateRequestBuilder`][UpdateRequestBuilder] with this `Client` that can be configured before sending.
 
     For more details, see:
@@ -63,7 +86,7 @@ where
     # Examples
 
     Update a [`DocumentType`][documents-mod] called `MyType` with an id of `1` using a new document value:
-    
+
     ```no_run
     # extern crate serde;
     # #[macro_use]
@@ -193,9 +216,8 @@ where
     [send-async]: requests/document_update/type.UpdateRequestBuilder.html#send-asynchronously
     [documents-mod]: ../types/document/index.html
     */
-    pub fn update<TId>(self, id: TId) -> UpdateRequestBuilder<TSender, Doc<TDocument>>
+    pub fn update(self, id: impl Into<Id<'static>>) -> UpdateRequestBuilder<TSender, Doc<TDocument>>
     where
-        TId: Into<Id<'static>>,
         TDocument: DocumentType + StaticIndex + StaticType,
     {
         let index = TDocument::static_index().into();
@@ -218,7 +240,7 @@ impl<TSender> DocumentClient<TSender, ()>
 where
     TSender: Sender,
 {
-    /** 
+    /**
     Create an [`UpdateRequestBuilder`][UpdateRequestBuilder] with this `Client` that can be configured before sending.
 
     For more details, see:
@@ -230,7 +252,7 @@ where
     # Examples
 
     Update a document with an id of `1` using a new document value:
-    
+
     ```no_run
     # extern crate serde;
     # #[macro_use]
@@ -256,11 +278,11 @@ where
     # }
     ```
     */
-    pub fn update_raw<TIndex, TId>(self, index: TIndex, id: TId) -> UpdateRequestBuilder<TSender, Doc<()>>
-    where
-        TIndex: Into<Index<'static>>,
-        TId: Into<Id<'static>>,
-    {
+    pub fn update_raw(
+        self,
+        index: impl Into<Index<'static>>,
+        id: impl Into<Id<'static>>,
+    ) -> UpdateRequestBuilder<TSender, Doc<()>> {
         RequestBuilder::initial(
             self.inner,
             UpdateRequestInner {
@@ -282,10 +304,7 @@ where
         let body = serde_json::to_vec(&self.body).map_err(error::request)?;
 
         Ok(UpdateRequest::for_index_ty_id(
-            self.index,
-            self.ty,
-            self.id,
-            body,
+            self.index, self.ty, self.id, body,
         ))
     }
 }
@@ -300,30 +319,24 @@ where
     TSender: Sender,
 {
     /** Set the index for the update request. */
-    pub fn index<I>(mut self, index: I) -> Self
-    where
-        I: Into<Index<'static>>,
-    {
+    pub fn index(mut self, index: impl Into<Index<'static>>) -> Self {
         self.inner.index = index.into();
         self
     }
 
     /** Set the type for the update request. */
-    pub fn ty<I>(mut self, ty: I) -> Self
-    where
-        I: Into<Type<'static>>,
-    {
+    pub fn ty(mut self, ty: impl Into<Type<'static>>) -> Self {
         self.inner.ty = ty.into();
         self
     }
 
     /**
     Update the source using a document.
-    
+
     # Examples
 
     Update a [`DocumentType`][documents-mod] called `MyType` with an id of `1` using a new document value:
-    
+
     ```no_run
     # extern crate serde;
     # #[macro_use]
@@ -403,7 +416,7 @@ where
 
     /**
     Update the source using [an inline script][painless-lang].
-    
+
     # Examples
 
     Update the `title` property of a document using a script:
@@ -434,7 +447,7 @@ where
     ```
 
      Update the `title` property of a document using a parameterised script:
-    
+
     ```no_run
     # extern crate serde;
     # #[macro_use]
@@ -468,7 +481,10 @@ where
 
     [painless-lang]: https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting-painless.html
      */
-    pub fn script<TScript, TParams>(self, builder: TScript) -> UpdateRequestBuilder<TSender, Script<TParams>>
+    pub fn script<TScript, TParams>(
+        self,
+        builder: TScript,
+    ) -> UpdateRequestBuilder<TSender, Script<TParams>>
     where
         TScript: Into<ScriptBuilder<TParams>>,
     {
@@ -494,7 +510,7 @@ where
     # Examples
 
     Update the `title` property of a document using a parameterised script:
-    
+
     ```no_run
     # extern crate serde;
     # #[macro_use]
@@ -565,10 +581,13 @@ where
 
     [painless-lang]: https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting-painless.html
     */
-    pub fn script_fluent<TScript, TBuilder, TParams>(self, source: TScript, builder: TBuilder) -> UpdateRequestBuilder<TSender, Script<TParams>>
+    pub fn script_fluent<TScript, TParams>(
+        self,
+        source: TScript,
+        builder: impl Fn(ScriptBuilder<DefaultParams>) -> ScriptBuilder<TParams>,
+    ) -> UpdateRequestBuilder<TSender, Script<TParams>>
     where
         TScript: ToString,
-        TBuilder: Fn(ScriptBuilder<DefaultParams>) -> ScriptBuilder<TParams>,
     {
         let builder = builder(ScriptBuilder::new(source));
 
@@ -641,7 +660,7 @@ where
 {
     /**
     Send an `UpdateRequestBuilder` asynchronously using an [`AsyncClient`][AsyncClient].
-    
+
     This will return a future that will resolve to the deserialised update document response.
 
     # Examples
@@ -650,7 +669,7 @@ where
 
     ```no_run
     # extern crate futures;
-    # extern crate tokio_core;
+    # extern crate tokio;
     # extern crate serde;
     # extern crate serde_json;
     # #[macro_use] extern crate serde_derive;
@@ -661,14 +680,13 @@ where
     # use elastic::prelude::*;
     # fn main() { run().unwrap() }
     # fn run() -> Result<(), Box<::std::error::Error>> {
-    # let core = tokio_core::reactor::Core::new()?;
     # #[derive(Serialize, Deserialize, ElasticType)]
     # struct MyType {
     #     pub id: String,
     #     pub title: String,
     #     pub timestamp: Date<DefaultDateMapping>
     # }
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     # let new_doc = MyType { id: "1".to_owned(), title: String::new(), timestamp: Date::now() };
     let future = client.document::<MyType>()
                        .update(1)
@@ -729,12 +747,15 @@ impl Future for Pending {
 
 #[cfg(test)]
 mod tests {
-    use serde_json::{self, Value};
     use super::ScriptBuilder;
     use prelude::*;
+    use serde_json::{
+        self,
+        Value,
+    };
 
     #[derive(Serialize, ElasticType)]
-    struct TestDoc { }
+    struct TestDoc {}
 
     #[test]
     fn default_request() {
diff --git a/src/elastic/src/client/requests/index_close.rs b/src/elastic/src/client/requests/index_close.rs
index 4c51dafc9a..79e60fa8f8 100644
--- a/src/elastic/src/client/requests/index_close.rs
+++ b/src/elastic/src/client/requests/index_close.rs
@@ -4,19 +4,30 @@ Builders for [close index requests][docs-close-index].
 [docs-close-index]: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html
 */
 
-use futures::{Future, Poll};
+use futures::{
+    Future,
+    Poll,
+};
 
-use error::*;
-use client::IndexClient;
-use client::sender::{AsyncSender, Sender, SyncSender};
-use client::requests::{empty_body, DefaultBody, RequestBuilder};
-use client::requests::params::Index;
 use client::requests::endpoints::IndicesCloseRequest;
+use client::requests::params::Index;
 use client::requests::raw::RawRequestInner;
+use client::requests::{
+    empty_body,
+    DefaultBody,
+    RequestBuilder,
+};
 use client::responses::CommandResponse;
+use client::sender::{
+    AsyncSender,
+    Sender,
+    SyncSender,
+};
+use client::IndexClient;
+use error::*;
 
-/** 
-A [close index request][docs-close-index] builder that can be configured before sending. 
+/**
+A [close index request][docs-close-index] builder that can be configured before sending.
 
 Call [`Client.index_close`][Client.index_close] to get an `IndexCloseRequestBuilder`.
 The `send` method will either send the request [synchronously][send-sync] or [asynchronously][send-async], depending on the `Client` it was closed from.
@@ -40,18 +51,18 @@ impl<TSender> IndexClient<TSender>
 where
     TSender: Sender,
 {
-    /** 
+    /**
     Create an [`IndexCloseRequestBuilder`][IndexCloseRequestBuilder] with this `Client` that can be configured before sending.
 
     For more details, see:
 
     - [send synchronously][send-sync]
     - [send asynchronously][send-async]
-    
+
     # Examples
-    
+
     Close an index called `myindex`:
-    
+
     ```no_run
     # extern crate elastic;
     # use elastic::prelude::*;
@@ -91,9 +102,9 @@ impl IndexCloseRequestBuilder<SyncSender> {
     This will block the current thread until a response arrives and is deserialised.
 
     # Examples
-    
+
     Close an index called `myindex`:
-    
+
     ```no_run
     # extern crate elastic;
     # use elastic::prelude::*;
@@ -124,23 +135,22 @@ impl IndexCloseRequestBuilder<SyncSender> {
 impl IndexCloseRequestBuilder<AsyncSender> {
     /**
     Send an `IndexCloseRequestBuilder` asynchronously using an [`AsyncClient`][AsyncClient].
-    
+
     This will return a future that will resolve to the deserialised command response.
 
     # Examples
-    
+
     Close an index called `myindex`:
-    
+
     ```no_run
     # extern crate futures;
-    # extern crate tokio_core;
+    # extern crate tokio;
     # extern crate elastic;
     # use futures::Future;
     # use elastic::prelude::*;
     # fn main() { run().unwrap() }
     # fn run() -> Result<(), Box<::std::error::Error>> {
-    # let core = tokio_core::reactor::Core::new()?;
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     let future = client.index("myindex").close().send();
 
     future.and_then(|response| {
@@ -157,9 +167,10 @@ impl IndexCloseRequestBuilder<AsyncSender> {
     pub fn send(self) -> Pending {
         let req = self.inner.into_request();
 
-        let res_future = RequestBuilder::new(self.client, self.params_builder, RawRequestInner::new(req))
-            .send()
-            .and_then(|res| res.into_response());
+        let res_future =
+            RequestBuilder::new(self.client, self.params_builder, RawRequestInner::new(req))
+                .send()
+                .and_then(|res| res.into_response());
 
         Pending::new(res_future)
     }
@@ -194,8 +205,6 @@ impl Future for Pending {
 mod tests {
     use prelude::*;
 
-    
-
     #[test]
     fn default_request() {
         let client = SyncClientBuilder::new().build().unwrap();
diff --git a/src/elastic/src/client/requests/index_create.rs b/src/elastic/src/client/requests/index_create.rs
index 05d7caf8f1..973f44d181 100644
--- a/src/elastic/src/client/requests/index_create.rs
+++ b/src/elastic/src/client/requests/index_create.rs
@@ -4,19 +4,30 @@ Builders for [create index requests][docs-create-index].
 [docs-create-index]: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html
 */
 
-use futures::{Future, Poll};
+use futures::{
+    Future,
+    Poll,
+};
 
-use error::*;
-use client::IndexClient;
-use client::sender::{AsyncSender, Sender, SyncSender};
-use client::requests::{empty_body, DefaultBody, RequestBuilder};
-use client::requests::params::Index;
 use client::requests::endpoints::IndicesCreateRequest;
+use client::requests::params::Index;
 use client::requests::raw::RawRequestInner;
+use client::requests::{
+    empty_body,
+    DefaultBody,
+    RequestBuilder,
+};
 use client::responses::CommandResponse;
+use client::sender::{
+    AsyncSender,
+    Sender,
+    SyncSender,
+};
+use client::IndexClient;
+use error::*;
 
-/** 
-A [create index request][docs-create-index] builder that can be configured before sending. 
+/**
+A [create index request][docs-create-index] builder that can be configured before sending.
 
 Call [`Client.index_create`][Client.index_create] to get an `IndexCreateRequestBuilder`.
 The `send` method will either send the request [synchronously][send-sync] or [asynchronously][send-async], depending on the `Client` it was created from.
@@ -26,7 +37,8 @@ The `send` method will either send the request [synchronously][send-sync] or [as
 [send-async]: #send-asynchronously
 [Client.index_create]: ../../struct.Client.html#create-index-request
 */
-pub type IndexCreateRequestBuilder<TSender, TBody> = RequestBuilder<TSender, IndexCreateRequestInner<TBody>>;
+pub type IndexCreateRequestBuilder<TSender, TBody> =
+    RequestBuilder<TSender, IndexCreateRequestInner<TBody>>;
 
 #[doc(hidden)]
 pub struct IndexCreateRequestInner<TBody> {
@@ -41,7 +53,7 @@ impl<TSender> IndexClient<TSender>
 where
     TSender: Sender,
 {
-    /** 
+    /**
     Create an [`IndexCreateRequestBuilder`][IndexCreateRequestBuilder] with this `Client` that can be configured before sending.
 
     For more details, see:
@@ -49,11 +61,11 @@ where
     - [builder methods][builder-methods]
     - [send synchronously][send-sync]
     - [send asynchronously][send-async]
-    
+
     # Examples
-    
+
     Create an index called `myindex`:
-    
+
     ```no_run
     # extern crate elastic;
     # use elastic::prelude::*;
@@ -131,7 +143,7 @@ impl<TBody> IndexCreateRequestInner<TBody> {
     }
 }
 
-/** 
+/**
 # Builder methods
 
 Configure an `IndexCreateRequestBuilder` before sending it.
@@ -141,9 +153,9 @@ where
     TSender: Sender,
     TBody: Into<TSender::Body>,
 {
-    /** 
+    /**
     Set the body for the create index request.
-    
+
     If no body is specified then an empty query will be used.
     */
     pub fn body<TNewBody>(self, body: TNewBody) -> IndexCreateRequestBuilder<TSender, TNewBody>
@@ -174,9 +186,9 @@ where
     This will block the current thread until a response arrives and is deserialised.
 
     # Examples
-    
+
     Create an index called `myindex`:
-    
+
     ```no_run
     # extern crate elastic;
     # use elastic::prelude::*;
@@ -210,23 +222,22 @@ where
 {
     /**
     Send an `IndexCreateRequestBuilder` asynchronously using an [`AsyncClient`][AsyncClient].
-    
+
     This will return a future that will resolve to the deserialised command response.
 
     # Examples
-    
+
     Create an index called `myindex`:
-    
+
     ```no_run
     # extern crate futures;
-    # extern crate tokio_core;
+    # extern crate tokio;
     # extern crate elastic;
     # use futures::Future;
     # use elastic::prelude::*;
     # fn main() { run().unwrap() }
     # fn run() -> Result<(), Box<::std::error::Error>> {
-    # let core = tokio_core::reactor::Core::new()?;
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     let future = client.index("myindex").create().send();
 
     future.and_then(|response| {
@@ -243,9 +254,10 @@ where
     pub fn send(self) -> Pending {
         let req = self.inner.into_request();
 
-        let res_future = RequestBuilder::new(self.client, self.params_builder, RawRequestInner::new(req))
-            .send()
-            .and_then(|res| res.into_response());
+        let res_future =
+            RequestBuilder::new(self.client, self.params_builder, RawRequestInner::new(req))
+                .send()
+                .and_then(|res| res.into_response());
 
         Pending::new(res_future)
     }
diff --git a/src/elastic/src/client/requests/index_delete.rs b/src/elastic/src/client/requests/index_delete.rs
index 8cfd4d65e9..5eef78db3d 100644
--- a/src/elastic/src/client/requests/index_delete.rs
+++ b/src/elastic/src/client/requests/index_delete.rs
@@ -4,19 +4,26 @@ Builders for [delete index requests][docs-delete-index].
 [docs-delete-index]: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html
 */
 
-use futures::{Future, Poll};
+use futures::{
+    Future,
+    Poll,
+};
 
-use error::*;
-use client::IndexClient;
-use client::sender::{AsyncSender, Sender, SyncSender};
-use client::requests::RequestBuilder;
-use client::requests::params::Index;
 use client::requests::endpoints::IndicesDeleteRequest;
+use client::requests::params::Index;
 use client::requests::raw::RawRequestInner;
+use client::requests::RequestBuilder;
 use client::responses::CommandResponse;
+use client::sender::{
+    AsyncSender,
+    Sender,
+    SyncSender,
+};
+use client::IndexClient;
+use error::*;
 
-/** 
-A [delete index request][docs-delete-index] builder that can be configured before sending. 
+/**
+A [delete index request][docs-delete-index] builder that can be configured before sending.
 
 Call [`Client.index_delete`][Client.index_delete] to get an `IndexDeleteRequestBuilder`.
 The `send` method will either send the request [synchronously][send-sync] or [asynchronously][send-async], depending on the `Client` it was deleted from.
@@ -40,18 +47,18 @@ impl<TSender> IndexClient<TSender>
 where
     TSender: Sender,
 {
-    /** 
+    /**
     Delete a [`IndexDeleteRequestBuilder`][IndexDeleteRequestBuilder] with this `Client` that can be configured before sending.
 
     For more details, see:
 
     - [send synchronously][send-sync]
     - [send asynchronously][send-async]
-    
+
     # Examples
-    
+
     Delete an index called `myindex`:
-    
+
     ```no_run
     # extern crate elastic;
     # use elastic::prelude::*;
@@ -91,9 +98,9 @@ impl IndexDeleteRequestBuilder<SyncSender> {
     This will block the current thread until a response arrives and is deserialised.
 
     # Examples
-    
+
     Delete an index called `myindex`:
-    
+
     ```no_run
     # extern crate elastic;
     # use elastic::prelude::*;
@@ -124,23 +131,22 @@ impl IndexDeleteRequestBuilder<SyncSender> {
 impl IndexDeleteRequestBuilder<AsyncSender> {
     /**
     Send a `IndexDeleteRequestBuilder` asynchronously using an [`AsyncClient`][AsyncClient].
-    
+
     This will return a future that will resolve to the deserialised command response.
 
     # Examples
-    
+
     Delete an index called `myindex`:
-    
+
     ```no_run
     # extern crate futures;
-    # extern crate tokio_core;
+    # extern crate tokio;
     # extern crate elastic;
     # use futures::Future;
     # use elastic::prelude::*;
     # fn main() { run().unwrap() }
     # fn run() -> Result<(), Box<::std::error::Error>> {
-    # let core = tokio_core::reactor::Core::new()?;
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     let future = client.index("myindex").delete().send();
 
     future.and_then(|response| {
@@ -157,9 +163,10 @@ impl IndexDeleteRequestBuilder<AsyncSender> {
     pub fn send(self) -> Pending {
         let req = self.inner.into_request();
 
-        let res_future = RequestBuilder::new(self.client, self.params_builder, RawRequestInner::new(req))
-            .send()
-            .and_then(|res| res.into_response());
+        let res_future =
+            RequestBuilder::new(self.client, self.params_builder, RawRequestInner::new(req))
+                .send()
+                .and_then(|res| res.into_response());
 
         Pending::new(res_future)
     }
diff --git a/src/elastic/src/client/requests/index_exists.rs b/src/elastic/src/client/requests/index_exists.rs
index f243757d15..d0e2a60294 100644
--- a/src/elastic/src/client/requests/index_exists.rs
+++ b/src/elastic/src/client/requests/index_exists.rs
@@ -4,19 +4,26 @@ Builders for [index exists requests][docs-index-exists].
 [docs-index-exists]: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-exists.html
 */
 
-use futures::{Future, Poll};
+use futures::{
+    Future,
+    Poll,
+};
 
-use error::*;
-use client::IndexClient;
-use client::sender::{AsyncSender, Sender, SyncSender};
-use client::requests::RequestBuilder;
-use client::requests::params::Index;
 use client::requests::endpoints::IndicesExistsRequest;
+use client::requests::params::Index;
 use client::requests::raw::RawRequestInner;
+use client::requests::RequestBuilder;
 use client::responses::IndicesExistsResponse;
+use client::sender::{
+    AsyncSender,
+    Sender,
+    SyncSender,
+};
+use client::IndexClient;
+use error::*;
 
-/** 
-An [index exists request][docs-index-exists] builder that can be configured before sending. 
+/**
+An [index exists request][docs-index-exists] builder that can be configured before sending.
 
 Call [`Client.index_exists`][Client.index_exists] to get an `IndexExistsRequestBuilder`.
 The `send` method will either send the request [synchronously][send-sync] or [asynchronously][send-async], depending on the `Client` it was opend from.
@@ -40,18 +47,18 @@ impl<TSender> IndexClient<TSender>
 where
     TSender: Sender,
 {
-    /** 
+    /**
     Open an [`IndexExistsRequestBuilder`][IndexExistsRequestBuilder] with this `Client` that can be configured before sending.
 
     For more details, see:
 
     - [send synchronously][send-sync]
     - [send asynchronously][send-async]
-    
+
     # Examples
-    
+
     Check whether an index called `myindex` exists:
-    
+
     ```no_run
     # extern crate elastic;
     # use elastic::prelude::*;
@@ -91,9 +98,9 @@ impl IndexExistsRequestBuilder<SyncSender> {
     This will block the current thread until a response arrives and is deserialised.
 
     # Examples
-    
+
     Check whether an index called `myindex` exists:
-    
+
     ```no_run
     # extern crate elastic;
     # use elastic::prelude::*;
@@ -124,23 +131,22 @@ impl IndexExistsRequestBuilder<SyncSender> {
 impl IndexExistsRequestBuilder<AsyncSender> {
     /**
     Send an `IndexExistsRequestBuilder` asynchronously using an [`AsyncClient`][AsyncClient].
-    
+
     This will return a future that will resolve to the deserialised command response.
 
     # Examples
-    
+
     Check whether an index called `myindex` exists:
-    
+
     ```no_run
     # extern crate futures;
-    # extern crate tokio_core;
+    # extern crate tokio;
     # extern crate elastic;
     # use futures::Future;
     # use elastic::prelude::*;
     # fn main() { run().unwrap() }
     # fn run() -> Result<(), Box<::std::error::Error>> {
-    # let core = tokio_core::reactor::Core::new()?;
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     let future = client.index("myindex").exists().send();
 
     future.and_then(|response| {
@@ -157,9 +163,10 @@ impl IndexExistsRequestBuilder<AsyncSender> {
     pub fn send(self) -> Pending {
         let req = self.inner.into_request();
 
-        let res_future = RequestBuilder::new(self.client, self.params_builder, RawRequestInner::new(req))
-            .send()
-            .and_then(|res| res.into_response());
+        let res_future =
+            RequestBuilder::new(self.client, self.params_builder, RawRequestInner::new(req))
+                .send()
+                .and_then(|res| res.into_response());
 
         Pending::new(res_future)
     }
diff --git a/src/elastic/src/client/requests/index_open.rs b/src/elastic/src/client/requests/index_open.rs
index 37ca276d3f..d78db5608d 100644
--- a/src/elastic/src/client/requests/index_open.rs
+++ b/src/elastic/src/client/requests/index_open.rs
@@ -4,19 +4,30 @@ Builders for [open index requests][docs-open-index].
 [docs-open-index]: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html
 */
 
-use futures::{Future, Poll};
+use futures::{
+    Future,
+    Poll,
+};
 
-use error::*;
-use client::IndexClient;
-use client::sender::{AsyncSender, Sender, SyncSender};
-use client::requests::{empty_body, DefaultBody, RequestBuilder};
-use client::requests::params::Index;
 use client::requests::endpoints::IndicesOpenRequest;
+use client::requests::params::Index;
 use client::requests::raw::RawRequestInner;
+use client::requests::{
+    empty_body,
+    DefaultBody,
+    RequestBuilder,
+};
 use client::responses::CommandResponse;
+use client::sender::{
+    AsyncSender,
+    Sender,
+    SyncSender,
+};
+use client::IndexClient;
+use error::*;
 
-/** 
-An [open index request][docs-open-index] builder that can be configured before sending. 
+/**
+An [open index request][docs-open-index] builder that can be configured before sending.
 
 Call [`Client.index_open`][Client.index_open] to get an `IndexOpenRequestBuilder`.
 The `send` method will either send the request [synchronously][send-sync] or [asynchronously][send-async], depending on the `Client` it was opend from.
@@ -40,18 +51,18 @@ impl<TSender> IndexClient<TSender>
 where
     TSender: Sender,
 {
-    /** 
+    /**
     Open an [`IndexOpenRequestBuilder`][IndexOpenRequestBuilder] with this `Client` that can be configured before sending.
 
     For more details, see:
 
     - [send synchronously][send-sync]
     - [send asynchronously][send-async]
-    
+
     # Examples
-    
+
     Open an index called `myindex`:
-    
+
     ```no_run
     # extern crate elastic;
     # use elastic::prelude::*;
@@ -91,9 +102,9 @@ impl IndexOpenRequestBuilder<SyncSender> {
     This will block the current thread until a response arrives and is deserialised.
 
     # Examples
-    
+
     Open an index called `myindex`:
-    
+
     ```no_run
     # extern crate elastic;
     # use elastic::prelude::*;
@@ -124,23 +135,22 @@ impl IndexOpenRequestBuilder<SyncSender> {
 impl IndexOpenRequestBuilder<AsyncSender> {
     /**
     Send an `IndexOpenRequestBuilder` asynchronously using an [`AsyncClient`][AsyncClient].
-    
+
     This will return a future that will resolve to the deserialised command response.
 
     # Examples
-    
+
     Open an index called `myindex`:
-    
+
     ```no_run
     # extern crate futures;
-    # extern crate tokio_core;
+    # extern crate tokio;
     # extern crate elastic;
     # use futures::Future;
     # use elastic::prelude::*;
     # fn main() { run().unwrap() }
     # fn run() -> Result<(), Box<::std::error::Error>> {
-    # let core = tokio_core::reactor::Core::new()?;
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     let future = client.index("myindex").open().send();
 
     future.and_then(|response| {
@@ -157,9 +167,10 @@ impl IndexOpenRequestBuilder<AsyncSender> {
     pub fn send(self) -> Pending {
         let req = self.inner.into_request();
 
-        let res_future = RequestBuilder::new(self.client, self.params_builder, RawRequestInner::new(req))
-            .send()
-            .and_then(|res| res.into_response());
+        let res_future =
+            RequestBuilder::new(self.client, self.params_builder, RawRequestInner::new(req))
+                .send()
+                .and_then(|res| res.into_response());
 
         Pending::new(res_future)
     }
diff --git a/src/elastic/src/client/requests/mod.rs b/src/elastic/src/client/requests/mod.rs
index 87ab3145d5..ac87d883cf 100644
--- a/src/elastic/src/client/requests/mod.rs
+++ b/src/elastic/src/client/requests/mod.rs
@@ -4,18 +4,28 @@ Request types for the Elasticsearch REST API.
 This module contains implementation details that are useful if you want to customise the request process, but aren't generally important for sending requests.
 */
 
-use futures_cpupool::CpuPool;
 use fluent_builder::FluentBuilder;
-
+use std::sync::Arc;
+use tokio_threadpool::ThreadPool;
+
+use client::sender::{
+    AsyncSender,
+    RequestParams,
+    Sender,
+};
 use client::Client;
-use client::sender::{AsyncSender, RequestParams, Sender};
 
-pub use elastic_requests::{empty_body, DefaultBody, Endpoint, UrlPath};
-pub use elastic_requests::params;
 pub use elastic_requests::endpoints;
+pub use elastic_requests::params;
+pub use elastic_requests::{
+    empty_body,
+    DefaultBody,
+    Endpoint,
+    UrlPath,
+};
 
-pub use self::params::*;
 pub use self::endpoints::*;
+pub use self::params::*;
 
 pub mod raw;
 pub use self::raw::RawRequestBuilder;
@@ -25,34 +35,34 @@ pub mod search;
 pub use self::search::SearchRequestBuilder;
 
 // Document requests
+pub mod document_delete;
 pub mod document_get;
 pub mod document_index;
-pub mod document_update;
-pub mod document_delete;
 pub mod document_put_mapping;
+pub mod document_update;
+pub use self::document_delete::DeleteRequestBuilder;
 pub use self::document_get::GetRequestBuilder;
 pub use self::document_index::IndexRequestBuilder;
-pub use self::document_update::UpdateRequestBuilder;
-pub use self::document_delete::DeleteRequestBuilder;
 pub use self::document_put_mapping::PutMappingRequestBuilder;
+pub use self::document_update::UpdateRequestBuilder;
 
 // Index requests
-pub mod index_create;
-pub mod index_open;
 pub mod index_close;
+pub mod index_create;
 pub mod index_delete;
 pub mod index_exists;
-pub use self::index_create::IndexCreateRequestBuilder;
-pub use self::index_open::IndexOpenRequestBuilder;
+pub mod index_open;
 pub use self::index_close::IndexCloseRequestBuilder;
+pub use self::index_create::IndexCreateRequestBuilder;
 pub use self::index_delete::IndexDeleteRequestBuilder;
 pub use self::index_exists::IndexExistsRequestBuilder;
+pub use self::index_open::IndexOpenRequestBuilder;
 
 // Misc requests
-pub mod ping;
 pub mod bulk;
-pub use self::ping::PingRequestBuilder;
+pub mod ping;
 pub use self::bulk::BulkRequestBuilder;
+pub use self::ping::PingRequestBuilder;
 
 pub mod common;
 
@@ -103,15 +113,15 @@ where
 
     /**
     Override the parameters for this request.
-    
+
     This method will box the given closure and use it to mutate the request parameters.
     It will be called after a node address has been chosen so `params` can be used to override the url a request will be sent to.
     Each call to `params` will be chained so it can be called multiple times but it's recommended to only call once.
-    
+
     # Examples
-    
+
     Add a url param to force an index refresh:
-    
+
     ```no_run
     # extern crate elastic;
     # use elastic::prelude::*;
@@ -140,10 +150,10 @@ where
     # }
     ```
     */
-    pub fn params_fluent<F>(mut self, builder: F) -> Self
-    where
-        F: Fn(RequestParams) -> RequestParams + 'static,
-    {
+    pub fn params_fluent(
+        mut self,
+        builder: impl Fn(RequestParams) -> RequestParams + 'static,
+    ) -> Self {
         self.params_builder = self.params_builder.fluent(builder).boxed();
 
         self
@@ -154,11 +164,11 @@ where
 
     This method differs from `params_fluent` by not taking any default parameters into account.
     The `RequestParams` passed in are exactly the `RequestParams` used to build the request.
-    
+
     # Examples
-    
+
     Add a url param to force an index refresh and send the request to `http://different-host:9200`:
-    
+
     ```no_run
     # extern crate elastic;
     # use elastic::prelude::*;
@@ -172,10 +182,7 @@ where
     # }
     ```
     */
-    pub fn params<I>(mut self, params: I) -> Self
-    where
-        I: Into<RequestParams>,
-    {
+    pub fn params(mut self, params: impl Into<RequestParams>) -> Self {
         self.params_builder = self.params_builder.value(params.into());
 
         self
@@ -190,41 +197,40 @@ The following methods can be called on any asynchronous request builder.
 impl<TRequest> RequestBuilder<AsyncSender, TRequest> {
     /**
     Override the thread pool used for deserialisation for this request.
-        
+
     # Examples
 
     Use the given thread pool to deserialise the response:
 
     ```no_run
-    # extern crate tokio_core;
-    # extern crate futures_cpupool;
+    # extern crate tokio;
+    # extern crate tokio_threadpool;
     # extern crate elastic;
-    # use futures_cpupool::CpuPool;
+    # use std::sync::Arc;
+    # use tokio_threadpool::ThreadPool;
     # use elastic::prelude::*;
     # fn main() { run().unwrap() }
     # fn run() -> Result<(), Box<::std::error::Error>> {
-    # let core = tokio_core::reactor::Core::new()?;
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     # fn get_req() -> PingRequest<'static> { PingRequest::new() }
-    let pool = CpuPool::new(4);
+    let pool = ThreadPool::new();
     let builder = client.request(get_req())
-                        .serde_pool(pool.clone());
+                        .serde_pool(Arc::new(pool));
     # Ok(())
     # }
     ```
-    
+
     Never deserialise the response on a thread pool:
-    
+
     ```no_run
-    # extern crate tokio_core;
-    # extern crate futures_cpupool;
+    # extern crate tokio;
+    # extern crate tokio_threadpool;
     # extern crate elastic;
-    # use futures_cpupool::CpuPool;
+    # use tokio_threadpool::ThreadPool;
     # use elastic::prelude::*;
     # fn main() { run().unwrap() }
     # fn run() -> Result<(), Box<::std::error::Error>> {
-    # let core = tokio_core::reactor::Core::new()?;
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     # fn get_req() -> PingRequest<'static> { PingRequest::new() }
     let builder = client.request(get_req())
                         .serde_pool(None);
@@ -232,10 +238,7 @@ impl<TRequest> RequestBuilder<AsyncSender, TRequest> {
     # }
     ```
     */
-    pub fn serde_pool<P>(mut self, pool: P) -> Self
-    where
-        P: Into<Option<CpuPool>>,
-    {
+    pub fn serde_pool(mut self, pool: impl Into<Option<Arc<ThreadPool>>>) -> Self {
         self.client.sender.serde_pool = pool.into();
 
         self
@@ -245,13 +248,13 @@ impl<TRequest> RequestBuilder<AsyncSender, TRequest> {
 pub mod prelude {
     /*! A glob import for convenience. */
 
-    pub use super::params::*;
     pub use super::endpoints::*;
+    pub use super::params::*;
 
     pub use super::bulk::{
-        BulkOperation,
         bulk,
         bulk_raw,
+        BulkOperation,
     };
 
     pub use super::{
@@ -259,15 +262,15 @@ pub mod prelude {
         DefaultBody,
         DeleteRequestBuilder,
         GetRequestBuilder,
+        IndexCloseRequestBuilder,
         IndexCreateRequestBuilder,
         IndexDeleteRequestBuilder,
         IndexOpenRequestBuilder,
-        IndexCloseRequestBuilder,
         IndexRequestBuilder,
+        PingRequestBuilder,
         PutMappingRequestBuilder,
         RawRequestBuilder,
         SearchRequestBuilder,
-        PingRequestBuilder,
         UpdateRequestBuilder,
     };
 }
diff --git a/src/elastic/src/client/requests/ping.rs b/src/elastic/src/client/requests/ping.rs
index a60dc0abb1..3cd6c13ad5 100644
--- a/src/elastic/src/client/requests/ping.rs
+++ b/src/elastic/src/client/requests/ping.rs
@@ -2,18 +2,28 @@
 Builders for ping requests.
 */
 
-use futures::{Future, Poll};
+use futures::{
+    Future,
+    Poll,
+};
 
-use error::{Error, Result};
-use client::Client;
-use client::sender::{AsyncSender, Sender, SyncSender};
-use client::requests::RequestBuilder;
 use client::requests::endpoints::PingRequest;
 use client::requests::raw::RawRequestInner;
+use client::requests::RequestBuilder;
 use client::responses::PingResponse;
+use client::sender::{
+    AsyncSender,
+    Sender,
+    SyncSender,
+};
+use client::Client;
+use error::{
+    Error,
+    Result,
+};
 
 /**
-A ping request builder that can be configured before sending. 
+A ping request builder that can be configured before sending.
 
 Call [`Client.ping`][Client.ping] to get a `PingRequestBuilder`.
 The `send` method will either send the request [synchronously][send-sync] or [asynchronously][send-async], depending on the `Client` it was created from.
@@ -34,7 +44,7 @@ impl<TSender> Client<TSender>
 where
     TSender: Sender,
 {
-    /** 
+    /**
     Create a [`PingRequestBuilder`][PingRequestBuilder] with this `Client` that can be configured before sending.
 
     For more details, see:
@@ -92,7 +102,7 @@ impl PingRequestBuilder<SyncSender> {
     # Examples
 
     Ping an Elasticsearch node:
-    
+
     ```no_run
     # extern crate serde;
     # #[macro_use] extern crate serde_derive;
@@ -129,15 +139,15 @@ impl PingRequestBuilder<SyncSender> {
 impl PingRequestBuilder<AsyncSender> {
     /**
     Send a `PingRequestBuilder` asynchronously using an [`AsyncClient`][AsyncClient].
-    
+
     This will return a future that will resolve to the deserialised ping response.
 
     # Examples
 
     Ping an Elasticsearch node:
-    
+
     ```no_run
-    # extern crate tokio_core;
+    # extern crate tokio;
     # extern crate futures;
     # extern crate serde;
     # #[macro_use] extern crate serde_derive;
@@ -149,8 +159,7 @@ impl PingRequestBuilder<AsyncSender> {
     # fn run() -> Result<(), Box<::std::error::Error>> {
     # #[derive(Debug, Serialize, Deserialize, ElasticType)]
     # struct MyType { }
-    # let core = tokio_core::reactor::Core::new()?;
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     let future = client.ping().send();
 
     future.and_then(|response| {
@@ -167,9 +176,10 @@ impl PingRequestBuilder<AsyncSender> {
     pub fn send(self) -> Pending {
         let req = self.inner.into_request();
 
-        let res_future = RequestBuilder::new(self.client, self.params_builder, RawRequestInner::new(req))
-            .send()
-            .and_then(|res| res.into_response());
+        let res_future =
+            RequestBuilder::new(self.client, self.params_builder, RawRequestInner::new(req))
+                .send()
+                .and_then(|res| res.into_response());
 
         Pending::new(res_future)
     }
diff --git a/src/elastic/src/client/requests/raw.rs b/src/elastic/src/client/requests/raw.rs
index c4e0f130dd..122ce02add 100644
--- a/src/elastic/src/client/requests/raw.rs
+++ b/src/elastic/src/client/requests/raw.rs
@@ -2,22 +2,32 @@
 Builders for raw requests.
 */
 
-use std::marker::PhantomData;
 use fluent_builder::TryIntoValue;
+use std::marker::PhantomData;
 
+use client::requests::{
+    Endpoint,
+    RequestBuilder,
+};
+use client::sender::{
+    NextParams,
+    NodeAddresses,
+    SendableRequest,
+    SendableRequestParams,
+    Sender,
+};
 use client::Client;
-use client::sender::{NextParams, NodeAddresses, SendableRequest, SendableRequestParams, Sender};
-use client::requests::{Endpoint, RequestBuilder};
 
 /**
 A raw request builder that can be configured before sending.
 
-Call [`Client.request`][Client.request] to get an `IndexRequest`. 
+Call [`Client.request`][Client.request] to get an `IndexRequest`.
 The `send` method will either send the request synchronously or asynchronously, depending on the `Client` it was created from.
 
 [Client.request]: ../../struct.Client.html#raw-request
 */
-pub type RawRequestBuilder<TSender, TEndpoint, TBody> = RequestBuilder<TSender, RawRequestInner<TEndpoint, TBody>>;
+pub type RawRequestBuilder<TSender, TEndpoint, TBody> =
+    RequestBuilder<TSender, RawRequestInner<TEndpoint, TBody>>;
 
 #[doc(hidden)]
 pub struct RawRequestInner<TEndpoint, TBody> {
@@ -48,9 +58,9 @@ where
     which includes the endpoint types in the [`endpoints`][endpoints-mod] module.
 
     # Examples
-    
+
     Send a cluster ping and read the returned metadata:
-    
+
     ```no_run
     # extern crate elastic;
     # use elastic::prelude::*;
@@ -59,10 +69,10 @@ where
     # let client = SyncClientBuilder::new().build()?;
     // `PingRequest` implements `Into<Endpoint>`
     let req = PingRequest::new();
-    
+
     // Turn the `PingRequest` into a `RequestBuilder`
     let builder = client.request(req);
-    
+
     // Send the `RequestBuilder` and parse as a `PingResponse`
     let ping = builder.send()?.into_response::<PingResponse>()?;
 
@@ -75,7 +85,10 @@ where
     [RawRequestBuilder]: requests/raw/type.RawRequestBuilder.html
     [endpoints-mod]: requests/endpoints/index.html
     */
-    pub fn request<TEndpoint, TBody>(&self, endpoint: TEndpoint) -> RawRequestBuilder<TSender, TEndpoint, TBody>
+    pub fn request<TEndpoint, TBody>(
+        &self,
+        endpoint: TEndpoint,
+    ) -> RawRequestBuilder<TSender, TEndpoint, TBody>
     where
         TEndpoint: Into<Endpoint<'static, TBody>>,
         TBody: Into<TSender::Body>,
@@ -116,7 +129,7 @@ where
     let response = client.request(SimpleSearchRequest::for_index_ty("myindex", "mytype"))
                          .send()?
                          .into_response::<SearchResponse<Value>>()?;
-    
+
     // Iterate through the hits (of type `MyType`)
     for hit in response.hits() {
         println!("{:?}", hit);
@@ -128,7 +141,7 @@ where
     Send a raw request asynchronously and parse it to a concrete response type:
 
     ```no_run
-    # extern crate tokio_core;
+    # extern crate tokio;
     # extern crate futures;
     # extern crate elastic;
     # extern crate serde_json;
@@ -137,12 +150,11 @@ where
     # use futures::Future;
     # fn main() { run().unwrap() }
     # fn run() -> Result<(), Box<::std::error::Error>> {
-    # let core = tokio_core::reactor::Core::new()?;
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     let future = client.request(SimpleSearchRequest::for_index_ty("myindex", "mytype"))
                        .send()
                        .and_then(|res| res.into_response::<SearchResponse<Value>>());
-    
+
     future.and_then(|response| {
         // Iterate through the hits (of type `MyType`)
         for hit in response.hits() {
diff --git a/src/elastic/src/client/requests/search.rs b/src/elastic/src/client/requests/search.rs
index 6d25b010fa..1b18e74b4f 100644
--- a/src/elastic/src/client/requests/search.rs
+++ b/src/elastic/src/client/requests/search.rs
@@ -4,22 +4,42 @@ Builders for [search requests][docs-search].
 [docs-search]: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html
 */
 
-use std::marker::PhantomData;
-use futures::{Future, Poll};
+use futures::{
+    Future,
+    Poll,
+};
 use serde::de::DeserializeOwned;
+use std::marker::PhantomData;
 
-use error::{Error, Result};
-use client::{DocumentClient, Client};
-use client::sender::{AsyncSender, Sender, SyncSender};
-use client::requests::{empty_body, DefaultBody, RequestBuilder};
-use client::requests::params::{Index, Type};
 use client::requests::endpoints::SearchRequest;
+use client::requests::params::{
+    Index,
+    Type,
+};
 use client::requests::raw::RawRequestInner;
+use client::requests::{
+    empty_body,
+    DefaultBody,
+    RequestBuilder,
+};
 use client::responses::SearchResponse;
+use client::sender::{
+    AsyncSender,
+    Sender,
+    SyncSender,
+};
+use client::{
+    Client,
+    DocumentClient,
+};
+use error::{
+    Error,
+    Result,
+};
 use types::document::DocumentType;
 
 /**
-A [search request][docs-search] builder that can be configured before sending. 
+A [search request][docs-search] builder that can be configured before sending.
 
 Call [`Client.search`][Client.search] to get a `SearchRequestBuilder`.
 The `send` method will either send the request [synchronously][send-sync] or [asynchronously][send-async], depending on the `Client` it was created from.
@@ -29,7 +49,8 @@ The `send` method will either send the request [synchronously][send-sync] or [as
 [send-async]: #send-asynchronously
 [Client.search]: ../../struct.Client.html#search-request
 */
-pub type SearchRequestBuilder<TSender, TDocument, TBody> = RequestBuilder<TSender, SearchRequestInner<TDocument, TBody>>;
+pub type SearchRequestBuilder<TSender, TDocument, TBody> =
+    RequestBuilder<TSender, SearchRequestInner<TDocument, TBody>>;
 
 #[doc(hidden)]
 pub struct SearchRequestInner<TDocument, TBody> {
@@ -46,7 +67,7 @@ impl<TSender> Client<TSender>
 where
     TSender: Sender,
 {
-    /** 
+    /**
     Create a [`SearchRequestBuilder`][SearchRequestBuilder] with this `Client` that can be configured before sending.
 
     For more details, see:
@@ -58,7 +79,7 @@ where
     # Examples
 
     Run a simple [Query String][docs-querystring] query for a [`DocumentType`][documents-mod] called `MyType`:
-    
+
     ```no_run
     # extern crate serde;
     # #[macro_use] extern crate serde_derive;
@@ -106,7 +127,7 @@ where
     # let client = SyncClientBuilder::new().build()?;
     let response = client.search::<Value>()
                          .index("myindex")
-                         .ty(Some("mytype"))
+                         .ty("my-type")
                          .send()?;
     # Ok(())
     # }
@@ -135,7 +156,7 @@ impl<TSender, TDocument> DocumentClient<TSender, TDocument>
 where
     TSender: Sender,
 {
-    /** 
+    /**
     Create a [`SearchRequestBuilder`][SearchRequestBuilder] with this `Client` that can be configured before sending.
 
     The index and type parameters will be inferred from the document type.
@@ -149,7 +170,7 @@ where
     # Examples
 
     Run a simple [Query String][docs-querystring] query for a [`DocumentType`][documents-mod] called `MyType`:
-    
+
     ```no_run
     # extern crate serde;
     # #[macro_use] extern crate serde_derive;
@@ -201,13 +222,14 @@ where
         let ty = TDocument::partial_static_ty().map(|ty| Type::from(ty));
 
         RequestBuilder::initial(
-            self.inner, 
+            self.inner,
             SearchRequestInner {
                 index: index,
                 ty: ty,
                 body: empty_body(),
                 _marker: PhantomData,
-            })
+            },
+        )
     }
 }
 
@@ -245,32 +267,29 @@ where
 {
     /**
     Set the indices for the search request.
-    
+
     If no index is specified then `_all` will be used.
     */
-    pub fn index<I>(mut self, index: I) -> Self
-    where
-        I: Into<Index<'static>>,
-    {
+    pub fn index(mut self, index: impl Into<Index<'static>>) -> Self {
         self.inner.index = Some(index.into());
         self
     }
 
     /** Set the types for the search request. */
-    pub fn ty<I>(mut self, ty: Option<I>) -> Self
-    where
-        I: Into<Type<'static>>,
-    {
-        self.inner.ty = ty.map(Into::into);
+    pub fn ty(mut self, ty: impl Into<Type<'static>>) -> Self {
+        self.inner.ty = Some(ty.into());
         self
     }
 
     /**
     Set the body for the search request.
-    
+
     If no body is specified then an empty query will be used.
     */
-    pub fn body<TNewBody>(self, body: TNewBody) -> SearchRequestBuilder<TSender, TDocument, TNewBody>
+    pub fn body<TNewBody>(
+        self,
+        body: TNewBody,
+    ) -> SearchRequestBuilder<TSender, TDocument, TNewBody>
     where
         TNewBody: Into<TSender::Body>,
     {
@@ -303,7 +322,7 @@ where
     # Examples
 
     Run a simple [Query String][docs-querystring] query for a [`DocumentType`][documents-mod] called `MyType`:
-    
+
     ```no_run
     # extern crate serde;
     # #[macro_use] extern crate serde_derive;
@@ -350,15 +369,15 @@ where
 {
     /**
     Send a `SearchRequestBuilder` asynchronously using an [`AsyncClient`][AsyncClient].
-    
+
     This will return a future that will resolve to the deserialised search response.
 
     # Examples
 
     Run a simple [Query String][docs-querystring] query for a [`DocumentType`][documents-mod] called `MyType`:
-    
+
     ```no_run
-    # extern crate tokio_core;
+    # extern crate tokio;
     # extern crate futures;
     # extern crate serde;
     # #[macro_use] extern crate serde_derive;
@@ -370,8 +389,7 @@ where
     # fn run() -> Result<(), Box<::std::error::Error>> {
     # #[derive(Debug, Serialize, Deserialize, ElasticType)]
     # struct MyType { }
-    # let core = tokio_core::reactor::Core::new()?;
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     let future = client.search::<MyType>()
                        .index("myindex")
                        .send();
@@ -395,9 +413,10 @@ where
     pub fn send(self) -> Pending<TDocument> {
         let req = self.inner.into_request();
 
-        let res_future = RequestBuilder::new(self.client, self.params_builder, RawRequestInner::new(req))
-            .send()
-            .and_then(|res| res.into_response());
+        let res_future =
+            RequestBuilder::new(self.client, self.params_builder, RawRequestInner::new(req))
+                .send()
+                .and_then(|res| res.into_response());
 
         Pending::new(res_future)
     }
@@ -433,8 +452,8 @@ where
 
 #[cfg(test)]
 mod tests {
-    use serde_json::Value;
     use prelude::*;
+    use serde_json::Value;
 
     #[test]
     fn default_request() {
@@ -462,11 +481,7 @@ mod tests {
     fn specify_ty() {
         let client = SyncClientBuilder::new().build().unwrap();
 
-        let req = client
-            .search::<Value>()
-            .ty(Some("new-ty"))
-            .inner
-            .into_request();
+        let req = client.search::<Value>().ty("new-ty").inner.into_request();
 
         assert_eq!("/_all/new-ty/_search", req.url.as_ref());
     }
diff --git a/src/elastic/src/client/responses/async.rs b/src/elastic/src/client/responses/async.rs
index 1d1b7aa13c..9bdb718dc5 100644
--- a/src/elastic/src/client/responses/async.rs
+++ b/src/elastic/src/client/responses/async.rs
@@ -1,11 +1,28 @@
-use futures::{Future, Poll, Stream};
-use futures_cpupool::CpuPool;
+use std::sync::Arc;
+
+use futures::future::lazy;
+use futures::{
+    Future,
+    Poll,
+    Stream,
+};
+use reqwest::async::Response as RawResponse;
 use serde::de::DeserializeOwned;
-use reqwest::unstable::async::Response as RawResponse;
-
-use error::{self, Error};
-use http::{AsyncChunk, AsyncHttpResponse, StatusCode};
-use super::parse::{parse, IsOk};
+use tokio_threadpool::ThreadPool;
+
+use super::parse::{
+    parse,
+    IsOk,
+};
+use error::{
+    self,
+    Error,
+};
+use http::{
+    AsyncChunk,
+    AsyncHttpResponse,
+    StatusCode,
+};
 
 /**
 A builder for a response.
@@ -16,10 +33,13 @@ You can also `Read` directly from the response body.
 pub struct AsyncResponseBuilder {
     inner: RawResponse,
     status: StatusCode,
-    de_pool: Option<CpuPool>,
+    de_pool: Option<Arc<ThreadPool>>,
 }
 
-pub(crate) fn async_response(res: RawResponse, de_pool: Option<CpuPool>) -> Result<AsyncResponseBuilder, Error> {
+pub(crate) fn async_response(
+    res: RawResponse,
+    de_pool: Option<Arc<ThreadPool>>,
+) -> Result<AsyncResponseBuilder, Error> {
     let status = StatusCode::from_u16(res.status().into()).map_err(error::request)?;
     Ok(AsyncResponseBuilder {
         inner: res,
@@ -36,7 +56,7 @@ impl AsyncResponseBuilder {
 
     /**
     Get the response body from JSON.
-    
+
     Convert the builder into a raw HTTP response that implements `Read`.
     */
     pub fn into_raw(self) -> AsyncHttpResponse {
@@ -45,18 +65,18 @@ impl AsyncResponseBuilder {
 
     /**
     Parse an API response type from the HTTP body.
-    
+
     The deserialisation may occur on a background thread.
     This will consume the `AsyncResponseBuilder` and return a [concrete response type][response-types] or an error.
-    
+
     The response is parsed according to the `IsOk` implementation for `T` that will inspect the response and either return an `Ok(T)` or an `Err(ApiError)`.
-    
+
     # Examples
-    
+
     Get a strongly typed `SearchResponse`:
-    
+
     ```no_run
-    # extern crate tokio_core;
+    # extern crate tokio;
     # extern crate futures;
     # extern crate serde;
     # #[macro_use] extern crate serde_derive;
@@ -68,8 +88,7 @@ impl AsyncResponseBuilder {
     # fn run() -> Result<(), Box<::std::error::Error>> {
     # #[derive(Debug, Serialize, Deserialize, ElasticType)]
     # struct MyType { }
-    # let core = tokio_core::reactor::Core::new()?;
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     let future = client.request(SimpleSearchRequest::for_index_ty("myindex", "mytype"))
                        .send()
                        .and_then(|response| response.into_response::<SearchResponse<MyType>>());
@@ -85,12 +104,12 @@ impl AsyncResponseBuilder {
     # Ok(())
     # }
     ```
-    
+
     You can also read a response as a `serde_json::Value`, which will be `Ok(Value)`
     if the HTTP status code is `Ok` or `Err(ApiError)` otherwise:
-    
+
     ```no_run
-    # extern crate tokio_core;
+    # extern crate tokio;
     # extern crate futures;
     # extern crate serde_json;
     # extern crate elastic;
@@ -99,8 +118,7 @@ impl AsyncResponseBuilder {
     # use elastic::prelude::*;
     # fn main() { run().unwrap() }
     # fn run() -> Result<(), Box<::std::error::Error>> {
-    # let core = tokio_core::reactor::Core::new()?;
-    # let client = AsyncClientBuilder::new().build(&core.handle())?;
+    # let client = AsyncClientBuilder::new().build()?;
     let future = client.request(SimpleSearchRequest::for_index_ty("myindex", "mytype"))
                        .send()
                        .and_then(|response| response.into_response::<Value>());
@@ -126,7 +144,9 @@ impl AsyncResponseBuilder {
         let body_future = body.concat2().map_err(move |e| error::response(status, e));
 
         if let Some(de_pool) = self.de_pool {
-            IntoResponse::new(body_future.and_then(move |body| de_pool.spawn_fn(move || de_fn(body))))
+            IntoResponse::new(
+                body_future.and_then(move |body| de_pool.spawn_handle(lazy(move || de_fn(body)))),
+            )
         } else {
             IntoResponse::new(body_future.and_then(de_fn))
         }
diff --git a/src/elastic/src/client/responses/mod.rs b/src/elastic/src/client/responses/mod.rs
index cc3c747002..7f640e3a6f 100644
--- a/src/elastic/src/client/responses/mod.rs
+++ b/src/elastic/src/client/responses/mod.rs
@@ -8,22 +8,48 @@ This module also contains helpers that can be used to parse responses from a raw
 [request-builders]: ../index.html#request-builders
 */
 
-mod sync;
 mod async;
+mod sync;
 
 pub mod parse;
 
-pub use self::sync::*;
 pub use self::async::*;
+pub use self::sync::*;
 
-pub use elastic_responses::{BulkErrorsResponse, BulkResponse, CommandResponse, DeleteResponse, GetResponse, IndexResponse, IndicesExistsResponse, PingResponse, SearchResponse, Shards, UpdateResponse};
+pub use elastic_responses::{
+    BulkErrorsResponse,
+    BulkResponse,
+    CommandResponse,
+    DeleteResponse,
+    GetResponse,
+    IndexResponse,
+    IndicesExistsResponse,
+    PingResponse,
+    SearchResponse,
+    Shards,
+    UpdateResponse,
+};
 
-pub use elastic_responses::search;
 pub use elastic_responses::bulk;
+pub use elastic_responses::search;
 
 pub mod prelude {
     /*! A glob import for convenience. */
 
     pub use super::bulk::Action as BulkAction;
-    pub use super::{AsyncResponseBuilder, SyncResponseBuilder, BulkErrorsResponse, BulkResponse, CommandResponse, DeleteResponse, GetResponse, IndexResponse, IndicesExistsResponse, PingResponse, SearchResponse, Shards, UpdateResponse};
+    pub use super::{
+        AsyncResponseBuilder,
+        BulkErrorsResponse,
+        BulkResponse,
+        CommandResponse,
+        DeleteResponse,
+        GetResponse,
+        IndexResponse,
+        IndicesExistsResponse,
+        PingResponse,
+        SearchResponse,
+        Shards,
+        SyncResponseBuilder,
+        UpdateResponse,
+    };
 }
diff --git a/src/elastic/src/client/responses/parse.rs b/src/elastic/src/client/responses/parse.rs
index 0f7994cad1..00d8552eb7 100644
--- a/src/elastic/src/client/responses/parse.rs
+++ b/src/elastic/src/client/responses/parse.rs
@@ -89,5 +89,14 @@ See the [`IsOk`][IsOk] trait for more details.
 
 pub(crate) use elastic_responses::parse;
 
-pub use elastic_responses::parsing::{Buffered, HttpResponseHead, IsOk, IsOkOnSuccess, MaybeBufferedResponse, MaybeOkResponse, ResponseBody, Unbuffered};
 pub use elastic_responses::error::ParseError;
+pub use elastic_responses::parsing::{
+    Buffered,
+    HttpResponseHead,
+    IsOk,
+    IsOkOnSuccess,
+    MaybeBufferedResponse,
+    MaybeOkResponse,
+    ResponseBody,
+    Unbuffered,
+};
diff --git a/src/elastic/src/client/responses/sync.rs b/src/elastic/src/client/responses/sync.rs
index d9307cd968..df20a80b27 100644
--- a/src/elastic/src/client/responses/sync.rs
+++ b/src/elastic/src/client/responses/sync.rs
@@ -1,9 +1,18 @@
-use serde::de::DeserializeOwned;
 use reqwest::Response as RawResponse;
+use serde::de::DeserializeOwned;
 
-use error::{self, Result};
-use http::{StatusCode, SyncHttpResponse};
-use super::parse::{parse, IsOk};
+use super::parse::{
+    parse,
+    IsOk,
+};
+use error::{
+    self,
+    Result,
+};
+use http::{
+    StatusCode,
+    SyncHttpResponse,
+};
 
 /**
 A builder for a response.
@@ -26,7 +35,7 @@ impl SyncResponseBuilder {
 
     /**
     Get the response body from JSON.
-    
+
     Convert the builder into a raw HTTP response that implements `Read`.
     */
     pub fn into_raw(self) -> SyncHttpResponse {
@@ -35,15 +44,15 @@ impl SyncResponseBuilder {
 
     /**
     Parse an API response type from the HTTP body.
-    
+
     This will consume the `SyncResponseBuilder` and return a [concrete response type][response-types] or an error.
-    
+
     The response is parsed according to the `IsOk` implementation for `T` that will inspect the response and either return an `Ok(T)` or an `Err(ApiError)`.
-    
+
     # Examples
-    
+
     Get a strongly typed `SearchResponse`:
-    
+
     ```no_run
     # extern crate serde;
     # #[macro_use]
@@ -67,10 +76,10 @@ impl SyncResponseBuilder {
     # Ok(())
     # }
     ```
-    
+
     You can also read a response as a `serde_json::Value`, which will be `Ok(Value)`
     if the HTTP status code is `Ok` or `Err(ApiError)` otherwise:
-    
+
     ```no_run
     # extern crate elastic;
     # extern crate serde_json;
diff --git a/src/elastic/src/client/sender/async.rs b/src/elastic/src/client/sender/async.rs
index 2efb77f446..e42be21e61 100644
--- a/src/elastic/src/client/sender/async.rs
+++ b/src/elastic/src/client/sender/async.rs
@@ -1,23 +1,58 @@
-use std::sync::Arc;
-use std::error::Error as StdError;
-use futures::{Future, IntoFuture, Poll};
-use futures::future::{FutureResult, Either};
-use futures_cpupool::{CpuPool, CpuFuture};
-use tokio_core::reactor::Handle;
-use reqwest::Error as ReqwestError;
-use reqwest::unstable::async::{Client as AsyncHttpClient, ClientBuilder as AsyncHttpClientBuilder, RequestBuilder as AsyncHttpRequestBuilder};
 use fluent_builder::FluentBuilder;
+use futures::future::{
+    lazy,
+    Either,
+    FutureResult,
+};
+use futures::{
+    Future,
+    IntoFuture,
+    Poll,
+};
+use reqwest::async::{
+    Client as AsyncHttpClient,
+    RequestBuilder as AsyncHttpRequestBuilder,
+};
+use std::error::Error as StdError;
+use std::sync::Arc;
+use tokio_threadpool::{
+    SpawnHandle,
+    ThreadPool,
+};
 
-use error::{self, Error};
-use private;
 use client::requests::Endpoint;
-use http::{AsyncBody, AsyncHttpRequest, Url};
-use client::sender::{build_reqwest_method, build_url, NextParams, NodeAddress, NodeAddresses, NodeAddressesBuilder, NodeAddressesInner, PreRequestParams, RequestParams, SendableRequest, SendableRequestParams, Sender};
+use client::responses::{
+    async_response,
+    AsyncResponseBuilder,
+};
 use client::sender::sniffed_nodes::SniffedNodesBuilder;
-use client::responses::{async_response, AsyncResponseBuilder};
+use client::sender::{
+    build_reqwest_method,
+    build_url,
+    NextParams,
+    NodeAddress,
+    NodeAddresses,
+    NodeAddressesBuilder,
+    NodeAddressesInner,
+    PreRequestParams,
+    RequestParams,
+    SendableRequest,
+    SendableRequestParams,
+    Sender,
+};
 use client::Client;
+use error::{
+    self,
+    Error,
+};
+use http::{
+    AsyncBody,
+    AsyncHttpRequest,
+    Url,
+};
+use private;
 
-/** 
+/**
 An asynchronous Elasticsearch client.
 
 Use an [`AsyncClientBuilder`][AsyncClientBuilder] to configure and build an `AsyncClient`.
@@ -29,21 +64,19 @@ Create an asynchronous `Client` and send a ping request:
 
 ```no_run
 # extern crate futures;
-# extern crate tokio_core;
+# extern crate tokio;
 # extern crate elastic;
 # use futures::Future;
-# use tokio_core::reactor::Core;
 # use elastic::prelude::*;
 # fn main() { run().unwrap() }
 # fn run() -> Result<(), Box<::std::error::Error>> {
-let mut core = Core::new()?;
-let client = AsyncClientBuilder::new().build(&core.handle())?;
+let client = AsyncClientBuilder::new().build()?;
 
 let response_future = client.request(PingRequest::new())
                             .send()
                             .and_then(|res| res.into_response::<PingResponse>());
 
-core.run(response_future)?;
+tokio::runtime::current_thread::block_on_all(response_future)?;
 # Ok(())
 # }
 ```
@@ -57,21 +90,29 @@ pub type AsyncClient = Client<AsyncSender>;
 #[derive(Clone)]
 pub struct AsyncSender {
     pub(in client) http: AsyncHttpClient,
-    pub(in client) serde_pool: Option<CpuPool>,
-    pre_send: Option<Arc<Fn(&mut AsyncHttpRequest) -> Box<Future<Item = (), Error = Box<StdError + Send + Sync>>>>>,
+    pub(in client) serde_pool: Option<Arc<ThreadPool>>,
+    pre_send: Option<
+        Arc<
+            Fn(
+                &mut AsyncHttpRequest,
+            ) -> Box<Future<Item = (), Error = Box<StdError + Send + Sync>>>,
+        >,
+    >,
 }
 
 impl private::Sealed for AsyncSender {}
 
 impl AsyncSender {
-    pub(crate) fn maybe_async<TFn, TResult>(&self, f: TFn)
-    -> Either<CpuFuture<TResult, Error>, FutureResult<TResult, Error>>
+    pub(crate) fn maybe_async<TFn, TResult>(
+        &self,
+        f: TFn,
+    ) -> Either<SpawnHandle<TResult, Error>, FutureResult<TResult, Error>>
     where
         TFn: FnOnce() -> Result<TResult, Error> + Send + 'static,
         TResult: Send + 'static,
     {
         if let Some(ref ser_pool) = self.serde_pool {
-            Either::A(ser_pool.spawn_fn(f))
+            Either::A(ser_pool.spawn_handle(lazy(f)))
         } else {
             Either::B(f().into_future())
         }
@@ -83,7 +124,10 @@ impl Sender for AsyncSender {
     type Response = PendingResponse;
     type Params = PendingParams;
 
-    fn send<TEndpoint, TParams, TBody>(&self, request: SendableRequest<TEndpoint, TParams, TBody>) -> Self::Response
+    fn send<TEndpoint, TParams, TBody>(
+        &self,
+        request: SendableRequest<TEndpoint, TParams, TBody>,
+    ) -> Self::Response
     where
         TEndpoint: Into<Endpoint<'static, TBody>>,
         TBody: Into<Self::Body> + 'static,
@@ -128,7 +172,6 @@ impl Sender for AsyncSender {
                     method,
                     headers: params.get_headers(),
                     body: body.map(|body| body.into()),
-                    _private: (),
                 })
             });
 
@@ -241,10 +284,10 @@ fn build_reqwest(client: &AsyncHttpClient, req: AsyncHttpRequest) -> AsyncHttpRe
 
     let mut req = client.request(method, url);
     {
-        req.headers(headers);
+        req = req.headers((&*headers).clone());
 
         if let Some(body) = body {
-            req.body(body.into_inner());
+            req = req.body(body.into_inner());
         }
     }
 
@@ -278,42 +321,17 @@ impl Future for PendingResponse {
 
 /** A builder for an asynchronous client. */
 pub struct AsyncClientBuilder {
-    serde_pool: Option<CpuPool>,
+    http: Option<AsyncHttpClient>,
+    serde_pool: Option<Arc<ThreadPool>>,
     nodes: NodeAddressesBuilder,
     params: FluentBuilder<PreRequestParams>,
-    pre_send: Option<Arc<Fn(&mut AsyncHttpRequest) -> Box<Future<Item = (), Error = Box<StdError + Send + Sync>>>>>,
-}
-
-/**
-A type that can be used to construct an async http client.
-
-This trait has a few default implementations:
-
-- `AsyncHttpClient`: returns `self`
-- `Handle`: returns a new `AsyncHttpClient` bound to `self`.
-*/
-pub trait IntoAsyncHttpClient {
-    /** The type of error returned by the conversion. */
-    type Error: StdError + Send + 'static;
-
-    /** Convert `self` into an `AsyncHttpClient`. */
-    fn into_async_http_client(self) -> Result<AsyncHttpClient, Self::Error>;
-}
-
-impl IntoAsyncHttpClient for AsyncHttpClient {
-    type Error = Error;
-
-    fn into_async_http_client(self) -> Result<AsyncHttpClient, Self::Error> {
-        Ok(self)
-    }
-}
-
-impl<'a> IntoAsyncHttpClient for &'a Handle {
-    type Error = ReqwestError;
-
-    fn into_async_http_client(self) -> Result<AsyncHttpClient, Self::Error> {
-        AsyncHttpClientBuilder::new().build(self)
-    }
+    pre_send: Option<
+        Arc<
+            Fn(
+                &mut AsyncHttpRequest,
+            ) -> Box<Future<Item = (), Error = Box<StdError + Send + Sync>>>,
+        >,
+    >,
 }
 
 impl Default for AsyncClientBuilder {
@@ -323,7 +341,7 @@ impl Default for AsyncClientBuilder {
 }
 
 impl AsyncClientBuilder {
-    /** 
+    /**
     Create a new client builder.
 
     By default, a client constructed by this builder will:
@@ -335,6 +353,7 @@ impl AsyncClientBuilder {
     */
     pub fn new() -> Self {
         AsyncClientBuilder {
+            http: None,
             serde_pool: None,
             params: FluentBuilder::new(),
             nodes: NodeAddressesBuilder::default(),
@@ -347,6 +366,7 @@ impl AsyncClientBuilder {
     */
     pub fn from_params(params: PreRequestParams) -> Self {
         AsyncClientBuilder {
+            http: None,
             serde_pool: None,
             params: FluentBuilder::new().value(params),
             nodes: NodeAddressesBuilder::default(),
@@ -357,10 +377,7 @@ impl AsyncClientBuilder {
     /**
     Specify a static node nodes to send requests to.
     */
-    pub fn static_node<S>(self, node: S) -> Self
-    where
-        S: Into<NodeAddress>,
-    {
+    pub fn static_node(self, node: impl Into<NodeAddress>) -> Self {
         self.static_nodes(vec![node])
     }
 
@@ -391,10 +408,7 @@ impl AsyncClientBuilder {
         .sniff_nodes("http://localhost:9200");
     ```
     */
-    pub fn sniff_nodes<I>(mut self, builder: I) -> Self
-    where
-        I: Into<SniffedNodesBuilder>,
-    {
+    pub fn sniff_nodes(mut self, builder: impl Into<SniffedNodesBuilder>) -> Self {
         self.nodes = self.nodes.sniff_nodes(builder.into());
 
         self
@@ -415,11 +429,11 @@ impl AsyncClientBuilder {
             .wait(Duration::from_secs(90)));
     ```
     */
-    pub fn sniff_nodes_fluent<I, F>(mut self, address: I, builder: F) -> Self
-    where
-        I: Into<NodeAddress>,
-        F: Fn(SniffedNodesBuilder) -> SniffedNodesBuilder + 'static,
-    {
+    pub fn sniff_nodes_fluent(
+        mut self,
+        address: impl Into<NodeAddress>,
+        builder: impl Fn(SniffedNodesBuilder) -> SniffedNodesBuilder + 'static,
+    ) -> Self {
         self.nodes = self.nodes.sniff_nodes_fluent(address.into(), builder);
 
         self
@@ -427,33 +441,22 @@ impl AsyncClientBuilder {
 
     /**
     Specify default request parameters.
-    
+
     # Examples
-    
-    Require all responses use pretty-printing:
-    
-    ```
-    # use elastic::prelude::*;
-    let builder = AsyncClientBuilder::new()
-        .params_fluent(|p| p
-            .url_param("pretty", true));
-    ```
 
-    Add an authorization header:
+    Require all responses use pretty-printing:
 
     ```
     # use elastic::prelude::*;
-    use elastic::http::header::Authorization;
-
     let builder = AsyncClientBuilder::new()
         .params_fluent(|p| p
-            .header(Authorization("let me in".to_owned())));
+            .url_param("pretty", true));
     ```
     */
-    pub fn params_fluent<F>(mut self, builder: F) -> Self
-    where
-        F: Fn(PreRequestParams) -> PreRequestParams + 'static,
-    {
+    pub fn params_fluent(
+        mut self,
+        builder: impl Fn(PreRequestParams) -> PreRequestParams + 'static,
+    ) -> Self {
         self.params = self.params.fluent(builder).boxed();
 
         self
@@ -463,38 +466,24 @@ impl AsyncClientBuilder {
     Specify default request parameters.
 
     # Examples
-    
-    Require all responses use pretty-printing:
-    
-    ```
-    # use elastic::prelude::*;
-    let builder = AsyncClientBuilder::new()
-        .params(PreRequestParams::new()
-            .url_param("pretty", true));
-    ```
 
-    Add an authorization header:
+    Require all responses use pretty-printing:
 
     ```
     # use elastic::prelude::*;
-    use elastic::http::header::Authorization;
-
     let builder = AsyncClientBuilder::new()
         .params(PreRequestParams::new()
-            .header(Authorization("let me in".to_owned())));
+            .url_param("pretty", true));
     ```
     */
-    pub fn params<I>(mut self, params: I) -> Self
-    where
-        I: Into<PreRequestParams>,
-    {
+    pub fn params(mut self, params: impl Into<PreRequestParams>) -> Self {
         self.params = self.params.value(params.into());
 
         self
     }
 
-    /** 
-    Use the given `CpuPool` for serialising and deserialising responses.
+    /**
+    Use the given `ThreadPool` for serialising and deserialising responses.
 
     If the pool is `None` then responses will be serialised and deserialised on the same thread as the io `Core`.
 
@@ -503,23 +492,21 @@ impl AsyncClientBuilder {
     Use a cpu pool to serialise and deserialise responses:
 
     ```
-    # extern crate futures_cpupool;
+    # extern crate tokio_threadpool;
     # extern crate elastic;
+    # use std::sync::Arc;
     # use elastic::prelude::*;
-    # use futures_cpupool::CpuPool;
+    # use tokio_threadpool::ThreadPool;
     # fn main() { run().unwrap() }
     # fn run() -> Result<(), Box<::std::error::Error>> {
-    let pool = CpuPool::new(4);
+    let pool = ThreadPool::new();
 
-    let builder = AsyncClientBuilder::new().serde_pool(pool);
+    let builder = AsyncClientBuilder::new().serde_pool(Arc::new(pool));
     # Ok(())
     # }
     ```
     */
-    pub fn serde_pool<P>(mut self, serde_pool: P) -> Self
-    where
-        P: Into<Option<CpuPool>>,
-    {
+    pub fn serde_pool(mut self, serde_pool: impl Into<Option<Arc<ThreadPool>>>) -> Self {
         self.serde_pool = serde_pool.into();
 
         self
@@ -532,69 +519,36 @@ impl AsyncClientBuilder {
     such as request singing.
     Prefer the `params` method on the client or individual requests where possible.
     */
-    pub fn pre_send_raw<F>(mut self, pre_send: F) -> Self
-    where
-        F: Fn(&mut AsyncHttpRequest) -> Box<Future<Item = (), Error = Box<StdError + Send + Sync>>> + 'static,
-    {
+    pub fn pre_send_raw(
+        mut self,
+        pre_send: impl Fn(
+                &mut AsyncHttpRequest,
+            ) -> Box<Future<Item = (), Error = Box<StdError + Send + Sync>>>
+            + 'static,
+    ) -> Self {
         self.pre_send = Some(Arc::new(pre_send));
 
         self
     }
 
-    /** 
-    Construct an [`AsyncClient`][AsyncClient] from this builder.
-
-    The `build` method accepts any type that can be used to construct a http client from.
-
-    # Examples
-
-    Build with an asynchronous `Handle`.
-    This will build an `AsyncClient` with a default underlying `AsyncHttpClient` using the handle.
-
-    ```no_run
-    # extern crate tokio_core;
-    # extern crate elastic;
-    # use elastic::prelude::*;
-    # use tokio_core::reactor::Core;
-    # fn main() { run().unwrap() }
-    # fn run() -> Result<(), Box<::std::error::Error>> {
-    let mut core = Core::new()?;
+    /** Use the given `reqwest::Client` for sending requests. */
+    pub fn http_client(mut self, client: AsyncHttpClient) -> Self {
+        self.http = Some(client);
 
-    let builder = AsyncClientBuilder::new().build(&core.handle());
-    # Ok(())
-    # }
-    ```
-
-    Build with a given `AsyncHttpClient`.
-
-    ```no_run
-    # extern crate tokio_core;
-    # extern crate reqwest;
-    # extern crate elastic;
-    # use tokio_core::reactor::Core;
-    # use reqwest::unstable::async::Client;
-    # use elastic::prelude::*;
-    # fn main() { run().unwrap() }
-    # fn run() -> Result<(), Box<::std::error::Error>> {
-    let mut core = Core::new()?;
-    let client = Client::new(&core.handle());
+        self
+    }
 
-    let builder = AsyncClientBuilder::new().build(client);
-    # Ok(())
-    # }
-    ```
+    /**
+    Construct an [`AsyncClient`][AsyncClient] from this builder.
 
     [AsyncClient]: type.AsyncClient.html
     */
-    pub fn build<TIntoHttp>(self, client: TIntoHttp) -> Result<AsyncClient, Error>
-    where
-        TIntoHttp: IntoAsyncHttpClient,
-    {
-        let http = client.into_async_http_client().map_err(error::build)?;
+    pub fn build(self) -> Result<AsyncClient, Error> {
+        let http = self.http.unwrap_or_else(|| AsyncHttpClient::new());
         let params = self.params.into_value(|| PreRequestParams::default());
 
         let sender = AsyncSender {
-            http: http,
+            http,
             serde_pool: self.serde_pool,
             pre_send: self.pre_send,
         };
diff --git a/src/elastic/src/client/sender/mod.rs b/src/elastic/src/client/sender/mod.rs
index bdd1871cb2..cf5190d466 100644
--- a/src/elastic/src/client/sender/mod.rs
+++ b/src/elastic/src/client/sender/mod.rs
@@ -13,25 +13,31 @@ Some notable types include:
 [Client]: ../struct.Client.html
 */
 
-use fluent_builder::{FluentBuilder, StatefulFluentBuilder};
+use fluent_builder::{
+    FluentBuilder,
+    StatefulFluentBuilder,
+};
 
-pub mod static_nodes;
 pub mod sniffed_nodes;
+pub mod static_nodes;
 
-mod sync;
 mod async;
 mod params;
-pub use self::sync::*;
+mod sync;
 pub use self::async::*;
 pub use self::params::*;
+pub use self::sync::*;
 
-use std::sync::Arc;
 use std::marker::PhantomData;
+use std::sync::Arc;
 use uuid::Uuid;
 
-use client::requests::Endpoint;
+use self::sniffed_nodes::{
+    SniffedNodes,
+    SniffedNodesBuilder,
+};
 use self::static_nodes::StaticNodes;
-use self::sniffed_nodes::{SniffedNodes, SniffedNodesBuilder};
+use client::requests::Endpoint;
 use private;
 
 /**
@@ -91,7 +97,10 @@ pub trait Sender: private::Sealed + Clone {
     type Params;
 
     /* Send a request. */
-    fn send<TEndpoint, TParams, TBody>(&self, request: SendableRequest<TEndpoint, TParams, TBody>) -> Self::Response
+    fn send<TEndpoint, TParams, TBody>(
+        &self,
+        request: SendableRequest<TEndpoint, TParams, TBody>,
+    ) -> Self::Response
     where
         TEndpoint: Into<Endpoint<'static, TBody>>,
         TBody: Into<Self::Body> + 'static,
@@ -176,7 +185,9 @@ enum NodeAddressesBuilder {
 impl NodeAddressesBuilder {
     fn sniff_nodes(self, builder: SniffedNodesBuilder) -> Self {
         match self {
-            NodeAddressesBuilder::Sniffed(fluent_builder) => NodeAddressesBuilder::Sniffed(fluent_builder.value(builder)),
+            NodeAddressesBuilder::Sniffed(fluent_builder) => {
+                NodeAddressesBuilder::Sniffed(fluent_builder.value(builder))
+            }
             _ => NodeAddressesBuilder::Sniffed(StatefulFluentBuilder::from_value(builder.into())),
         }
     }
@@ -186,8 +197,12 @@ impl NodeAddressesBuilder {
         F: FnOnce(SniffedNodesBuilder) -> SniffedNodesBuilder + 'static,
     {
         match self {
-            NodeAddressesBuilder::Sniffed(fluent_builder) => NodeAddressesBuilder::Sniffed(fluent_builder.fluent(address.into(), fleunt_method).boxed()),
-            _ => NodeAddressesBuilder::Sniffed(StatefulFluentBuilder::from_fluent(address.into(), fleunt_method).boxed()),
+            NodeAddressesBuilder::Sniffed(fluent_builder) => NodeAddressesBuilder::Sniffed(
+                fluent_builder.fluent(address.into(), fleunt_method).boxed(),
+            ),
+            _ => NodeAddressesBuilder::Sniffed(
+                StatefulFluentBuilder::from_fluent(address.into(), fleunt_method).boxed(),
+            ),
         }
     }
 }
diff --git a/src/elastic/src/client/sender/params.rs b/src/elastic/src/client/sender/params.rs
index fe17efc7a2..9c9ba653d0 100644
--- a/src/elastic/src/client/sender/params.rs
+++ b/src/elastic/src/client/sender/params.rs
@@ -1,12 +1,17 @@
-use std::sync::Arc;
 use std::collections::HashMap;
+use std::sync::Arc;
 
 use reqwest;
-use reqwest::header::{ContentType, Header, Headers};
+use reqwest::header::{
+    HeaderMap,
+    HeaderName,
+    HeaderValue,
+    CONTENT_TYPE,
+};
 use url::form_urlencoded::Serializer;
 
-use http::Method;
 use client::sender::NodeAddress;
+use http::Method;
 
 pub const DEFAULT_NODE_ADDRESS: &'static str = "http://localhost:9200";
 
@@ -19,8 +24,8 @@ When requests are load balanced between multiple Elasticsearch nodes the url to
 #[derive(Clone)]
 pub struct PreRequestParams {
     url_params: Arc<HashMap<&'static str, String>>,
-    // We should be able to replace this with `Arc<HeadersMap>` from the `http` crate
-    headers_builder: Option<Arc<Fn(&mut Headers) + Send + Sync + 'static>>,
+    // We should be able to replace this with `Arc<HeaderMapMap>` from the `http` crate
+    headers: Arc<HeaderMap>,
 }
 
 /**
@@ -49,10 +54,19 @@ let params = RequestParams::new("http://mybaseurl:9200");
 With custom headers:
 
 ```
-# use elastic::client::RequestParams;
-# use elastic::http::header::Authorization;
+# extern crate elastic;
+# use elastic::prelude::*;
+# use std::str::FromStr;
+# fn main() { run().unwrap() }
+# fn run() -> Result<(), Box<::std::error::Error>> {
+use elastic::http::header::{self, AUTHORIZATION, HeaderValue};
+
+let auth = HeaderValue::from_str("let me in")?;
+
 let params = RequestParams::default()
-    .header(Authorization("let me in".to_owned()));
+    .header(AUTHORIZATION, auth);
+# Ok(())
+# }
 ```
 
 With url query parameters:
@@ -71,58 +85,37 @@ pub struct RequestParams {
 }
 
 impl PreRequestParams {
-    /** 
+    /**
     Create a new container for request parameters.
-    
+
     This method takes a fully-qualified url for the Elasticsearch node.
     It will also set the `Content-Type` header to `application/json`.
     */
     pub fn new() -> Self {
         PreRequestParams {
-            headers_builder: None,
+            headers: Arc::new({
+                let mut headers = HeaderMap::new();
+                headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
+
+                headers
+            }),
             url_params: Arc::new(HashMap::new()),
         }
     }
 
-    /** 
+    /**
     Set a url param value.
-    
+
     These parameters are added as query parameters to request urls.
     */
-    pub fn url_param<T: ToString>(mut self, key: &'static str, value: T) -> Self {
+    pub fn url_param(mut self, key: &'static str, value: impl ToString) -> Self {
         Arc::make_mut(&mut self.url_params).insert(key, value.to_string());
         self
     }
 
     /** Set a request header. */
-    pub fn header<H>(self, header: H) -> Self
-    where
-        H: Header + Clone,
-    {
-        self.headers(move |h| h.set(header.clone()))
-    }
-
-    /** 
-    Set a header value on the params.
-    
-    Each call to `headers` will chain to the end of the last call.
-    This function allocates a new `Arc` for each call.
-    */
-    fn headers<F>(mut self, headers_builder: F) -> Self
-    where
-        F: Fn(&mut Headers) + Send + Sync + 'static,
-    {
-        if let Some(old_headers_builder) = self.headers_builder {
-            let headers_builder = move |mut headers: &mut Headers| {
-                old_headers_builder(&mut headers);
-                headers_builder(&mut headers);
-            };
-
-            self.headers_builder = Some(Arc::new(headers_builder));
-        } else {
-            self.headers_builder = Some(Arc::new(headers_builder));
-        }
-
+    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
+        Arc::make_mut(&mut self.headers).insert(key, value);
         self
     }
 }
@@ -135,45 +128,42 @@ impl Default for PreRequestParams {
 
 impl RequestParams {
     /** Create a container for request parameters from a base url and pre request parameters. */
-    pub fn from_parts<T: Into<NodeAddress>>(base_url: T, inner: PreRequestParams) -> Self {
+    pub fn from_parts(base_url: impl Into<NodeAddress>, inner: PreRequestParams) -> Self {
         RequestParams {
             base_url: base_url.into(),
             inner: inner,
         }
     }
 
-    /** 
+    /**
     Create a new container for request parameters.
-    
+
     This method takes a fully-qualified url for the Elasticsearch node.
     It will also set the `Content-Type` header to `application/json`.
     */
-    pub fn new<T: Into<NodeAddress>>(base_url: T) -> Self {
+    pub fn new(base_url: impl Into<NodeAddress>) -> Self {
         RequestParams::from_parts(base_url.into(), PreRequestParams::new())
     }
 
     /** Set the base url for the Elasticsearch node. */
-    pub fn base_url<T: Into<NodeAddress>>(mut self, base_url: T) -> Self {
+    pub fn base_url(mut self, base_url: impl Into<NodeAddress>) -> Self {
         self.base_url = base_url.into();
         self
     }
 
-    /** 
+    /**
     Set a url param value.
-    
+
     These parameters are added as query parameters to request urls.
     */
-    pub fn url_param<T: ToString>(mut self, key: &'static str, value: T) -> Self {
+    pub fn url_param(mut self, key: &'static str, value: impl ToString) -> Self {
         self.inner = self.inner.url_param(key, value);
         self
     }
 
     /** Set a request header. */
-    pub fn header<H>(mut self, header: H) -> Self
-    where
-        H: Header + Clone,
-    {
-        self.inner = self.inner.header(header);
+    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
+        self.inner = self.inner.header(key, value);
         self
     }
 
@@ -182,21 +172,13 @@ impl RequestParams {
         self.base_url.as_ref()
     }
 
-    /** Create a new `Headers` structure, and thread it through the configuration functions. */
-    pub fn get_headers(&self) -> Headers {
-        let mut headers = Headers::new();
-        headers.set(ContentType::json());
-
-        if let Some(ref headers_builder) = self.inner.headers_builder {
-            headers_builder(&mut headers);
-        }
-
-        headers
+    pub(crate) fn get_headers(&self) -> Arc<HeaderMap> {
+        self.inner.headers.clone()
     }
 
-    /** 
+    /**
     Get the url query params as a formatted string.
-    
+
     Follows the `application/x-www-form-urlencoded` format.
     This method returns the length of the query string and an optional value.
     If the value is `None`, then the length will be `0`.
@@ -242,21 +224,30 @@ pub(crate) fn build_url<'a>(req_url: &str, params: &RequestParams) -> String {
 
 pub(crate) fn build_reqwest_method(method: Method) -> reqwest::Method {
     match method {
-        Method::GET => reqwest::Method::Get,
-        Method::POST => reqwest::Method::Post,
-        Method::HEAD => reqwest::Method::Head,
-        Method::DELETE => reqwest::Method::Delete,
-        Method::PUT => reqwest::Method::Put,
-        Method::PATCH => reqwest::Method::Patch,
-        method => reqwest::Method::Extension(method.as_str().to_owned()),
+        Method::GET => reqwest::Method::GET,
+        Method::POST => reqwest::Method::POST,
+        Method::HEAD => reqwest::Method::HEAD,
+        Method::DELETE => reqwest::Method::DELETE,
+        Method::PUT => reqwest::Method::PUT,
+        Method::PATCH => reqwest::Method::PATCH,
+        method => {
+            reqwest::Method::from_bytes(method.as_str().as_bytes()).expect("invalid HTTP method")
+        }
     }
 }
 
 #[cfg(test)]
 mod tests {
-    use tests::{assert_send, assert_sync};
-    use http::header::{Authorization, ContentType, Referer};
     use super::*;
+    use http::header::{
+        AUTHORIZATION,
+        CONTENT_TYPE,
+        REFERER,
+    };
+    use tests::{
+        assert_send,
+        assert_sync,
+    };
 
     #[test]
     fn assert_send_sync() {
@@ -273,26 +264,38 @@ mod tests {
 
         let headers = req.get_headers();
 
-        assert_eq!(Some(&ContentType::json()), headers.get::<ContentType>());
+        assert_eq!(
+            Some("application/json"),
+            headers
+                .get(CONTENT_TYPE)
+                .map(|header| header.to_str().unwrap())
+        );
     }
 
     #[test]
     fn set_multiple_headers() {
         let req = RequestParams::new(DEFAULT_NODE_ADDRESS)
-            .header(Referer::new("/not-the-value"))
-            .header(Referer::new("/People.html#tim"))
-            .header(Authorization("let me in".to_owned()));
+            .header(REFERER, HeaderValue::from_str("/not-the-value").unwrap())
+            .header(REFERER, HeaderValue::from_str("/People.html#tim").unwrap())
+            .header(AUTHORIZATION, HeaderValue::from_str("let me in").unwrap());
 
         let headers = req.get_headers();
 
-        assert_eq!(Some(&ContentType::json()), headers.get::<ContentType>());
         assert_eq!(
-            Some(&Referer::new("/People.html#tim")),
-            headers.get::<Referer>()
+            Some("application/json"),
+            headers
+                .get(CONTENT_TYPE)
+                .map(|header| header.to_str().unwrap())
+        );
+        assert_eq!(
+            Some("/People.html#tim"),
+            headers.get(REFERER).map(|header| header.to_str().unwrap())
         );
         assert_eq!(
-            Some(&Authorization("let me in".to_owned())),
-            headers.get::<Authorization<String>>()
+            Some("let me in"),
+            headers
+                .get(AUTHORIZATION)
+                .map(|header| header.to_str().unwrap())
         );
     }
 
diff --git a/src/elastic/src/client/sender/sniffed_nodes/mod.rs b/src/elastic/src/client/sender/sniffed_nodes/mod.rs
index 96bb7e87fd..b41e245f4f 100644
--- a/src/elastic/src/client/sender/sniffed_nodes/mod.rs
+++ b/src/elastic/src/client/sender/sniffed_nodes/mod.rs
@@ -26,15 +26,40 @@ It's effectively a rewrite.
 mod nodes_info;
 use self::nodes_info::*;
 
-use std::time::{Duration, Instant};
-use std::sync::{Arc, RwLock};
+use futures::{
+    Future,
+    IntoFuture,
+};
+use std::sync::{
+    Arc,
+    RwLock,
+};
+use std::time::{
+    Duration,
+    Instant,
+};
 use url::Url;
-use futures::{Future, IntoFuture};
 
+use client::requests::{
+    DefaultBody,
+    NodesInfoRequest,
+};
 use client::sender::static_nodes::StaticNodes;
-use client::sender::{AsyncSender, NextParams, NodeAddress, PreRequestParams, RequestParams, SendableRequest, SendableRequestParams, Sender, SyncSender};
-use client::requests::{DefaultBody, NodesInfoRequest};
-use error::{self, Error};
+use client::sender::{
+    AsyncSender,
+    NextParams,
+    NodeAddress,
+    PreRequestParams,
+    RequestParams,
+    SendableRequest,
+    SendableRequestParams,
+    Sender,
+    SyncSender,
+};
+use error::{
+    self,
+    Error,
+};
 use private;
 
 /**
@@ -76,9 +101,14 @@ impl<TSender> SniffedNodes<TSender> {
 
     This method takes a generic function that will resolve to a new set of node addresses.
     */
-    fn async_next<TRefresh, TRefreshFuture>(&self, refresh: TRefresh) -> Box<Future<Item = RequestParams, Error = Error>>
+    fn async_next<TRefresh, TRefreshFuture>(
+        &self,
+        refresh: TRefresh,
+    ) -> Box<Future<Item = RequestParams, Error = Error>>
     where
-        TRefresh: Fn(SendableRequest<NodesInfoRequest<'static>, RequestParams, DefaultBody>) -> TRefreshFuture,
+        TRefresh: Fn(
+            SendableRequest<NodesInfoRequest<'static>, RequestParams, DefaultBody>,
+        ) -> TRefreshFuture,
         TRefreshFuture: Future<Item = NodesInfoResponse, Error = Error> + 'static,
     {
         if let Some(address) = self.next_or_start_refresh() {
@@ -90,7 +120,8 @@ impl<TSender> SniffedNodes<TSender> {
         let req = self.sendable_request();
         let refresh_params = self.refresh_params.clone();
 
-        let refresh_nodes = refresh(req).then(move |fresh_nodes| Self::finish_refresh(&inner, &refresh_params, fresh_nodes));
+        let refresh_nodes = refresh(req)
+            .then(move |fresh_nodes| Self::finish_refresh(&inner, &refresh_params, fresh_nodes));
 
         Box::new(refresh_nodes)
     }
@@ -102,7 +133,9 @@ impl<TSender> SniffedNodes<TSender> {
     */
     fn sync_next<TRefresh>(&self, refresh: TRefresh) -> Result<RequestParams, Error>
     where
-        TRefresh: Fn(SendableRequest<NodesInfoRequest<'static>, RequestParams, DefaultBody>) -> Result<NodesInfoResponse, Error>,
+        TRefresh: Fn(
+            SendableRequest<NodesInfoRequest<'static>, RequestParams, DefaultBody>,
+        ) -> Result<NodesInfoResponse, Error>,
     {
         if let Some(address) = self.next_or_start_refresh() {
             return address;
@@ -154,7 +187,11 @@ impl SniffedNodesBuilder {
 
     A `filter_path` url parameter will be added to the `refresh_parameters`.
     */
-    pub(crate) fn build<TSender>(self, base_params: PreRequestParams, sender: TSender) -> SniffedNodes<TSender> {
+    pub(crate) fn build<TSender>(
+        self,
+        base_params: PreRequestParams,
+        sender: TSender,
+    ) -> SniffedNodes<TSender> {
         let nodes = StaticNodes::round_robin(vec![self.base_url.clone()], base_params.clone());
         let wait = self.wait.unwrap_or_else(|| Duration::from_secs(90));
 
@@ -164,7 +201,8 @@ impl SniffedNodesBuilder {
         // - we want more metadata about the nodes
         // The publish_address may not correspond to the address the node is actually available on
         // In this case, we might want to offer some kind of filter function that consumers can use to transform nodes
-        let refresh_params = RequestParams::from_parts(self.base_url, base_params).url_param("filter_path", "nodes.*.http.publish_address");
+        let refresh_params = RequestParams::from_parts(self.base_url, base_params)
+            .url_param("filter_path", "nodes.*.http.publish_address");
 
         SniffedNodes {
             sender: sender,
@@ -236,21 +274,28 @@ impl<TSender> SniffedNodes<TSender> {
         })
     }
 
-    fn sendable_request(&self) -> SendableRequest<NodesInfoRequest<'static>, RequestParams, DefaultBody> {
+    fn sendable_request(
+        &self,
+    ) -> SendableRequest<NodesInfoRequest<'static>, RequestParams, DefaultBody> {
         SendableRequest::new(
             NodesInfoRequest::new(),
             SendableRequestParams::Value(self.refresh_params.clone()),
         )
     }
 
-    fn finish_refresh(inner: &RwLock<SniffedNodesInner>, refresh_params: &RequestParams, fresh_nodes: Result<NodesInfoResponse, Error>) -> Result<RequestParams, Error> {
+    fn finish_refresh(
+        inner: &RwLock<SniffedNodesInner>,
+        refresh_params: &RequestParams,
+        fresh_nodes: Result<NodesInfoResponse, Error>,
+    ) -> Result<RequestParams, Error> {
         let mut inner = inner.write().expect("lock poisoned");
 
         inner.refreshing = false;
 
         // TODO: We need to deal with the scheme better here
         // The `NodeAddress` should one day be a properly typed url we can interrogate
-        let parsed_url = Url::parse(refresh_params.get_base_url().as_ref()).map_err(error::request)?;
+        let parsed_url =
+            Url::parse(refresh_params.get_base_url().as_ref()).map_err(error::request)?;
         let scheme = parsed_url.scheme();
 
         let fresh_nodes = fresh_nodes?;
@@ -265,14 +310,19 @@ impl<TSender> SniffedNodes<TSender> {
 impl SniffedNodesInner {
     fn should_refresh(&self) -> bool {
         // If there isn't a value for the last update then assume we need to refresh.
-        let last_update_is_stale = self.last_update
+        let last_update_is_stale = self
+            .last_update
             .as_ref()
             .map(|last_update| last_update.elapsed() > self.wait);
 
         !self.refreshing && last_update_is_stale.unwrap_or(true)
     }
 
-    fn update_nodes_and_next(&mut self, parsed: NodesInfoResponse, scheme: &str) -> Result<RequestParams, Error> {
+    fn update_nodes_and_next(
+        &mut self,
+        parsed: NodesInfoResponse,
+        scheme: &str,
+    ) -> Result<RequestParams, Error> {
         let nodes: Vec<_> = parsed
             .into_iter()
             .filter_map(|node| {
@@ -318,8 +368,8 @@ impl NextParams for SniffedNodes<SyncSender> {
 
 #[cfg(test)]
 mod tests {
-    use futures::Future;
     use super::*;
+    use futures::Future;
 
     fn sender() -> SniffedNodes<()> {
         SniffedNodesBuilder::new(initial_address()).build(PreRequestParams::default(), ())
@@ -354,7 +404,10 @@ mod tests {
         vec!["http://a:9200", "http://127.0.0.1:9200"]
     }
 
-    fn assert_node_addresses_equal(nodes: &SniffedNodes<()>, expected_addresses: Vec<&'static str>) {
+    fn assert_node_addresses_equal(
+        nodes: &SniffedNodes<()>,
+        expected_addresses: Vec<&'static str>,
+    ) {
         let inner = nodes.inner.read().expect("lock poisoned");
         let actual: Vec<&str> = inner.nodes.get().iter().map(|node| node.as_ref()).collect();
 
diff --git a/src/elastic/src/client/sender/sniffed_nodes/nodes_info.rs b/src/elastic/src/client/sender/sniffed_nodes/nodes_info.rs
index 20b43a3bb8..e7fc065533 100644
--- a/src/elastic/src/client/sender/sniffed_nodes/nodes_info.rs
+++ b/src/elastic/src/client/sender/sniffed_nodes/nodes_info.rs
@@ -1,15 +1,21 @@
 /*! Contains the `NodesInfoResponse` type for sniffing node addresses in the cluster. */
 
-use std::fmt;
-use serde::de::{Deserialize, Deserializer, MapAccess, Visitor};
 use client::responses::parse::IsOkOnSuccess;
+use serde::de::{
+    Deserialize,
+    Deserializer,
+    MapAccess,
+    Visitor,
+};
+use std::fmt;
 
 use std::iter::IntoIterator;
 use std::vec::IntoIter;
 
 #[derive(Debug, PartialEq, Deserialize)]
 pub struct NodesInfoResponse {
-    #[serde(deserialize_with = "deserialize_nodes")] pub nodes: Vec<SniffedNode>,
+    #[serde(deserialize_with = "deserialize_nodes")]
+    pub nodes: Vec<SniffedNode>,
 }
 
 #[derive(Debug, PartialEq, Deserialize)]
@@ -80,8 +86,8 @@ where
 
 #[cfg(test)]
 mod tests {
-    use serde_json;
     use super::*;
+    use serde_json;
 
     #[test]
     fn deserialise_nodes() {
@@ -98,7 +104,8 @@ mod tests {
                     }
                 }
             }
-        }).to_string();
+        })
+        .to_string();
 
         let expected = NodesInfoResponse {
             nodes: vec![
@@ -124,7 +131,8 @@ mod tests {
     fn deserialise_nodes_empty() {
         let nodes = json!({
             "nodes": { }
-        }).to_string();
+        })
+        .to_string();
 
         let expected = NodesInfoResponse { nodes: vec![] };
 
diff --git a/src/elastic/src/client/sender/static_nodes.rs b/src/elastic/src/client/sender/static_nodes.rs
index e05e983e5f..c633897463 100644
--- a/src/elastic/src/client/sender/static_nodes.rs
+++ b/src/elastic/src/client/sender/static_nodes.rs
@@ -1,10 +1,21 @@
 /*! Multiple static nodes that can be load balanced by some strategy. */
 
-use std::sync::Arc;
-use std::sync::atomic::{AtomicUsize, Ordering};
-use client::sender::{NextParams, NodeAddress, PreRequestParams, RequestParams};
-use error::{self, Error};
+use client::sender::{
+    NextParams,
+    NodeAddress,
+    PreRequestParams,
+    RequestParams,
+};
+use error::{
+    self,
+    Error,
+};
 use private;
+use std::sync::atomic::{
+    AtomicUsize,
+    Ordering,
+};
+use std::sync::Arc;
 
 /** Select a base address for a given request using some strategy. */
 #[derive(Clone)]
@@ -74,7 +85,7 @@ pub trait Strategy: Send + Sync {
     fn try_next(&self, nodes: &[NodeAddress]) -> Result<NodeAddress, StrategyError>;
 }
 
-/** 
+/**
 An error attempting to get an address using a strategy.
 */
 quick_error! {
@@ -120,8 +131,8 @@ impl Strategy for RoundRobin {
 
 #[cfg(test)]
 mod tests {
-    use client::sender::NextParams;
     use super::*;
+    use client::sender::NextParams;
 
     fn round_robin(addresses: Vec<&'static str>) -> StaticNodes<RoundRobin> {
         StaticNodes::round_robin(addresses, PreRequestParams::default())
diff --git a/src/elastic/src/client/sender/sync.rs b/src/elastic/src/client/sender/sync.rs
index db42be9dbf..633b0c1083 100644
--- a/src/elastic/src/client/sender/sync.rs
+++ b/src/elastic/src/client/sender/sync.rs
@@ -1,23 +1,50 @@
-use std::sync::Arc;
-use std::error::Error as StdError;
-use reqwest::{Client as SyncHttpClient, ClientBuilder as SyncHttpClientBuilder, RequestBuilder as SyncHttpRequestBuilder};
 use fluent_builder::FluentBuilder;
+use reqwest::{
+    Client as SyncHttpClient,
+    ClientBuilder as SyncHttpClientBuilder,
+    RequestBuilder as SyncHttpRequestBuilder,
+};
+use std::error::Error as StdError;
+use std::sync::Arc;
 
-use error::{self, Error};
-use private;
-use client::sender::{build_reqwest_method, build_url, NextParams, NodeAddress, NodeAddresses, NodeAddressesBuilder, NodeAddressesInner, PreRequestParams, RequestParams, SendableRequest, SendableRequestParams, Sender};
-use client::sender::sniffed_nodes::SniffedNodesBuilder;
 use client::requests::Endpoint;
-use http::{SyncBody, SyncHttpRequest, Url};
-use client::responses::{sync_response, SyncResponseBuilder};
+use client::responses::{
+    sync_response,
+    SyncResponseBuilder,
+};
+use client::sender::sniffed_nodes::SniffedNodesBuilder;
+use client::sender::{
+    build_reqwest_method,
+    build_url,
+    NextParams,
+    NodeAddress,
+    NodeAddresses,
+    NodeAddressesBuilder,
+    NodeAddressesInner,
+    PreRequestParams,
+    RequestParams,
+    SendableRequest,
+    SendableRequestParams,
+    Sender,
+};
 use client::Client;
+use error::{
+    self,
+    Error,
+};
+use http::{
+    SyncBody,
+    SyncHttpRequest,
+    Url,
+};
+use private;
 
-/** 
+/**
 A synchronous Elasticsearch client.
 
 Use a [`SyncClientBuilder`][SyncClientBuilder] to configure and build a `SyncClient`.
 For more details about the methods available to a `SyncClient`, see the base [`Client`][Client] type.
- 
+
 # Examples
 
 Create a synchronous `Client` and send a ping request:
@@ -45,7 +72,9 @@ pub type SyncClient = Client<SyncSender>;
 #[derive(Clone)]
 pub struct SyncSender {
     pub(in client) http: SyncHttpClient,
-    pre_send: Option<Arc<Fn(&mut SyncHttpRequest) -> Result<(), Box<StdError + Send + Sync>> + Send + Sync>>,
+    pre_send: Option<
+        Arc<Fn(&mut SyncHttpRequest) -> Result<(), Box<StdError + Send + Sync>> + Send + Sync>,
+    >,
 }
 
 impl private::Sealed for SyncSender {}
@@ -55,7 +84,10 @@ impl Sender for SyncSender {
     type Response = Result<SyncResponseBuilder, Error>;
     type Params = Params;
 
-    fn send<TEndpoint, TParams, TBody>(&self, request: SendableRequest<TEndpoint, TParams, TBody>) -> Self::Response
+    fn send<TEndpoint, TParams, TBody>(
+        &self,
+        request: SendableRequest<TEndpoint, TParams, TBody>,
+    ) -> Self::Response
     where
         TEndpoint: Into<Endpoint<'static, TBody>>,
         TBody: Into<Self::Body> + 'static,
@@ -159,16 +191,15 @@ impl From<RequestParams> for Params {
 }
 
 /** Build an Elasticsearch request from an endpoint. */
-fn build_req<TBody>(endpoint: Endpoint<TBody>, params: RequestParams) -> Result<SyncHttpRequest, Error>
-where
-    TBody: Into<SyncBody>,
-{
+fn build_req(
+    endpoint: Endpoint<impl Into<SyncBody>>,
+    params: RequestParams,
+) -> Result<SyncHttpRequest, Error> {
     let endpoint = SyncHttpRequest {
         url: Url::parse(&build_url(&endpoint.url, &params)).map_err(error::request)?,
         method: endpoint.method,
         headers: params.get_headers(),
         body: endpoint.body.map(|body| body.into()),
-        _private: (),
     };
 
     Ok(endpoint)
@@ -188,10 +219,10 @@ fn build_reqwest(client: &SyncHttpClient, req: SyncHttpRequest) -> SyncHttpReque
 
     let mut req = client.request(method, url);
     {
-        req.headers(headers);
+        req = req.headers((&*headers).clone());
 
         if let Some(body) = body {
-            req.body(body.into_inner());
+            req = req.body(body.into_inner());
         }
     }
 
@@ -203,7 +234,14 @@ pub struct SyncClientBuilder {
     http: Option<SyncHttpClient>,
     nodes: NodeAddressesBuilder,
     params: FluentBuilder<PreRequestParams>,
-    pre_send: Option<Arc<Fn(&mut SyncHttpRequest) -> Result<(), Box<StdError + Send + Sync>> + Send + Sync + 'static>>,
+    pre_send: Option<
+        Arc<
+            Fn(&mut SyncHttpRequest) -> Result<(), Box<StdError + Send + Sync>>
+                + Send
+                + Sync
+                + 'static,
+        >,
+    >,
 }
 
 impl Default for SyncClientBuilder {
@@ -246,10 +284,7 @@ impl SyncClientBuilder {
     /**
     Specify a static node nodes to send requests to.
     */
-    pub fn static_node<S>(self, node: S) -> Self
-    where
-        S: Into<NodeAddress>,
-    {
+    pub fn static_node(self, node: impl Into<NodeAddress>) -> Self {
         self.static_nodes(vec![node])
     }
 
@@ -280,10 +315,7 @@ impl SyncClientBuilder {
         .sniff_nodes("http://localhost:9200");
     ```
     */
-    pub fn sniff_nodes<I>(mut self, builder: I) -> Self
-    where
-        I: Into<SniffedNodesBuilder>,
-    {
+    pub fn sniff_nodes(mut self, builder: impl Into<SniffedNodesBuilder>) -> Self {
         self.nodes = self.nodes.sniff_nodes(builder.into());
 
         self
@@ -304,11 +336,11 @@ impl SyncClientBuilder {
             .wait(Duration::from_secs(90)));
     ```
     */
-    pub fn sniff_nodes_fluent<I, F>(mut self, address: I, builder: F) -> Self
-    where
-        I: Into<NodeAddress>,
-        F: Fn(SniffedNodesBuilder) -> SniffedNodesBuilder + 'static,
-    {
+    pub fn sniff_nodes_fluent(
+        mut self,
+        address: impl Into<NodeAddress>,
+        builder: impl Fn(SniffedNodesBuilder) -> SniffedNodesBuilder + 'static,
+    ) -> Self {
         self.nodes = self.nodes.sniff_nodes_fluent(address.into(), builder);
 
         self
@@ -316,33 +348,22 @@ impl SyncClientBuilder {
 
     /**
     Specify default request parameters.
-    
+
     # Examples
-    
-    Require all responses use pretty-printing:
-    
-    ```
-    # use elastic::prelude::*;
-    let builder = SyncClientBuilder::new()
-        .params_fluent(|p| p
-            .url_param("pretty", true));
-    ```
 
-    Add an authorization header:
+    Require all responses use pretty-printing:
 
     ```
     # use elastic::prelude::*;
-    use elastic::http::header::Authorization;
-
     let builder = SyncClientBuilder::new()
         .params_fluent(|p| p
-            .header(Authorization("let me in".to_owned())));
+            .url_param("pretty", true));
     ```
     */
-    pub fn params_fluent<F>(mut self, builder: F) -> Self
-    where
-        F: Fn(PreRequestParams) -> PreRequestParams + 'static,
-    {
+    pub fn params_fluent(
+        mut self,
+        builder: impl Fn(PreRequestParams) -> PreRequestParams + 'static,
+    ) -> Self {
         self.params = self.params.fluent(builder).boxed();
 
         self
@@ -352,31 +373,17 @@ impl SyncClientBuilder {
     Specify default request parameters.
 
     # Examples
-    
-    Require all responses use pretty-printing:
-    
-    ```
-    # use elastic::prelude::*;
-    let builder = SyncClientBuilder::new()
-        .params(PreRequestParams::default()
-            .url_param("pretty", true));
-    ```
 
-    Add an authorization header:
+    Require all responses use pretty-printing:
 
     ```
     # use elastic::prelude::*;
-    use elastic::http::header::Authorization;
-
     let builder = SyncClientBuilder::new()
         .params(PreRequestParams::default()
-            .header(Authorization("let me in".to_owned())));
+            .url_param("pretty", true));
     ```
     */
-    pub fn params<I>(mut self, params: I) -> Self
-    where
-        I: Into<PreRequestParams>,
-    {
+    pub fn params(mut self, params: impl Into<PreRequestParams>) -> Self {
         self.params = self.params.value(params.into());
 
         self
@@ -396,22 +403,26 @@ impl SyncClientBuilder {
     such as request singing.
     Prefer the `params` method on the client or individual requests where possible.
     */
-    pub fn pre_send_raw<F>(mut self, pre_send: F) -> Self
-    where
-        F: Fn(&mut SyncHttpRequest) -> Result<(), Box<StdError + Send + Sync>> + Send + Sync + 'static,
-    {
+    pub fn pre_send_raw(
+        mut self,
+        pre_send: impl Fn(&mut SyncHttpRequest) -> Result<(), Box<StdError + Send + Sync>>
+            + Send
+            + Sync
+            + 'static,
+    ) -> Self {
         self.pre_send = Some(Arc::new(pre_send));
 
         self
     }
 
-    /** 
-    Construct a [`SyncClient`][SyncClient] from this builder. 
+    /**
+    Construct a [`SyncClient`][SyncClient] from this builder.
 
     [SyncClient]: type.SyncClient.html
     */
     pub fn build(self) -> Result<SyncClient, Error> {
-        let http = self.http
+        let http = self
+            .http
             .map(Ok)
             .unwrap_or_else(|| SyncHttpClientBuilder::new().build())
             .map_err(error::build)?;
diff --git a/src/elastic/src/error.rs b/src/elastic/src/error.rs
index b3111d2ad3..90a425e324 100644
--- a/src/elastic/src/error.rs
+++ b/src/elastic/src/error.rs
@@ -37,13 +37,13 @@ match response {
 ```
 */
 
-use std::io;
-use std::fmt;
 use std::error::Error as StdError;
+use std::fmt;
+use std::io;
 
-use serde_json;
-use reqwest::Error as ReqwestError;
 use elastic_responses::error::ResponseError;
+use reqwest::Error as ReqwestError;
+use serde_json;
 
 pub use elastic_responses::error::ApiError;
 
@@ -52,7 +52,7 @@ use http::StatusCode;
 /** An alias for a result. */
 pub type Result<T> = ::std::result::Result<T, Error>;
 
-/** 
+/**
 An error encountered while interacting with Elasticsearch.
 
 API errors can be easily matched and destructured whereas client errors
diff --git a/src/elastic/src/http/async.rs b/src/elastic/src/http/async.rs
index 2b3e262b5b..e05951ddac 100644
--- a/src/elastic/src/http/async.rs
+++ b/src/elastic/src/http/async.rs
@@ -1,16 +1,32 @@
 use bytes::Bytes;
 use serde_json::Value;
 use std::borrow::Cow;
-use std::io::{self, Cursor, Read};
-
-use tokio_io::AsyncRead;
-use futures::{Poll, Stream};
-use reqwest::unstable::async::{Body, Response as RawResponse};
-
-use error::{self, Error};
-use http::{HttpRequest, StatusCode};
-
-pub use reqwest::unstable::async::Chunk as AsyncChunk;
+use std::io::{
+    self,
+    Cursor,
+    Read,
+};
+
+use futures::{
+    Poll,
+    Stream,
+};
+use reqwest::async::{
+    Body,
+    Response as RawResponse,
+};
+use tokio::io::AsyncRead;
+
+use error::{
+    self,
+    Error,
+};
+use http::{
+    HttpRequest,
+    StatusCode,
+};
+
+pub use reqwest::async::Chunk as AsyncChunk;
 
 /** A http request with an asynchronous body; */
 pub type AsyncHttpRequest = HttpRequest<AsyncBody>;
@@ -141,8 +157,8 @@ impl AsyncHttpResponse {
 
 #[cfg(test)]
 mod tests {
-    use client::requests::empty_body;
     use super::*;
+    use client::requests::empty_body;
 
     #[test]
     fn owned_string_into_body() {
diff --git a/src/elastic/src/http/mod.rs b/src/elastic/src/http/mod.rs
index cf186fdb94..09baf222eb 100644
--- a/src/elastic/src/http/mod.rs
+++ b/src/elastic/src/http/mod.rs
@@ -1,36 +1,56 @@
-/*! 
+/*!
 Raw HTTP modules.
 
 These types are re-exported from `reqwest` and used in parts of `elastic`s public API.
 They may eventually be wrapped and made implementation details.
 */
 
-mod sync;
 mod async;
+mod sync;
 
-pub use self::sync::*;
 pub use self::async::*;
+pub use self::sync::*;
 
-pub use reqwest::Url;
 pub use reqwest::header;
+pub use reqwest::Url;
 
 pub use elastic_requests::Method;
 pub use elastic_responses::StatusCode;
 
-use std::fmt;
+use std::{
+    fmt,
+    sync::Arc,
+};
 
-use self::header::Headers;
+use self::header::HeaderMap;
 
 /**
 A request just before being sent.
 */
 #[derive(Clone)]
 pub struct HttpRequest<TBody> {
-    pub url: Url,
-    pub method: Method,
-    pub headers: Headers,
-    pub body: Option<TBody>,
-    pub(crate) _private: (),
+    pub(crate) url: Url,
+    pub(crate) method: Method,
+    pub(crate) headers: Arc<HeaderMap>,
+    pub(crate) body: Option<TBody>,
+}
+
+impl<TBody> HttpRequest<TBody> {
+    pub fn url_mut(&mut self) -> &mut Url {
+        &mut self.url
+    }
+
+    pub fn method_mut(&mut self) -> &mut Method {
+        &mut self.method
+    }
+
+    pub fn headers_mut(&mut self) -> &mut HeaderMap {
+        Arc::make_mut(&mut self.headers)
+    }
+
+    pub fn body_mut(&mut self) -> Option<&mut TBody> {
+        self.body.as_mut()
+    }
 }
 
 impl<TBody> fmt::Debug for HttpRequest<TBody> {
diff --git a/src/elastic/src/http/sync.rs b/src/elastic/src/http/sync.rs
index 403a2e0a7d..4606bd37d9 100644
--- a/src/elastic/src/http/sync.rs
+++ b/src/elastic/src/http/sync.rs
@@ -2,11 +2,21 @@ use bytes::Bytes;
 use serde_json::Value;
 use std::borrow::Cow;
 use std::fs::File;
-use std::io::{self, Cursor, Read};
-
-use reqwest::{Body, Response as RawResponse};
-
-use http::{HttpRequest, StatusCode};
+use std::io::{
+    self,
+    Cursor,
+    Read,
+};
+
+use reqwest::{
+    Body,
+    Response as RawResponse,
+};
+
+use http::{
+    HttpRequest,
+    StatusCode,
+};
 
 /** A http request with a synchronous body. */
 pub type SyncHttpRequest = HttpRequest<SyncBody>;
@@ -39,9 +49,15 @@ impl<'a> AsRef<[u8]> for BufferedSyncBodyInner<'a> {
 impl<'a> BufferedSyncBodyInner<'a> {
     fn as_ref(&self) -> BufferedSyncBodyInner {
         match *self {
-            BufferedSyncBodyInner::Shared(ref bytes) => BufferedSyncBodyInner::Shared(bytes.clone()),
-            BufferedSyncBodyInner::Bytes(ref bytes) => BufferedSyncBodyInner::Bytes(Cow::Borrowed(bytes)),
-            BufferedSyncBodyInner::Str(ref string) => BufferedSyncBodyInner::Str(Cow::Borrowed(string)),
+            BufferedSyncBodyInner::Shared(ref bytes) => {
+                BufferedSyncBodyInner::Shared(bytes.clone())
+            }
+            BufferedSyncBodyInner::Bytes(ref bytes) => {
+                BufferedSyncBodyInner::Bytes(Cow::Borrowed(bytes))
+            }
+            BufferedSyncBodyInner::Str(ref string) => {
+                BufferedSyncBodyInner::Str(Cow::Borrowed(string))
+            }
         }
     }
 }
@@ -71,7 +87,9 @@ impl SyncBody {
     pub fn reader(&mut self) -> SyncBodyReader {
         let state = match self.0 {
             SyncBodyInner::UnBuffered(ref mut reader) => SyncBodyReaderState::UnBuffered(reader),
-            SyncBodyInner::Buffered(ref inner) => SyncBodyReaderState::Buffered(Cursor::new(inner.as_ref())),
+            SyncBodyInner::Buffered(ref inner) => {
+                SyncBodyReaderState::Buffered(Cursor::new(inner.as_ref()))
+            }
         };
 
         SyncBodyReader { state }
@@ -98,7 +116,9 @@ impl<'a> SyncBodyReaderState<'a> {
                 let mut buf = Vec::new();
                 reader.read_to_end(&mut buf)?;
 
-                SyncBodyReaderState::Buffered(Cursor::new(BufferedSyncBodyInner::Bytes(Cow::Owned(buf))))
+                SyncBodyReaderState::Buffered(Cursor::new(BufferedSyncBodyInner::Bytes(
+                    Cow::Owned(buf),
+                )))
             }
         };
 
@@ -190,8 +210,8 @@ impl Read for SyncHttpResponse {
 
 #[cfg(test)]
 mod tests {
-    use client::requests::empty_body;
     use super::*;
+    use client::requests::empty_body;
 
     #[test]
     fn owned_string_into_body() {
diff --git a/src/elastic/src/lib.rs b/src/elastic/src/lib.rs
index ccb9fbafad..1360b059ec 100644
--- a/src/elastic/src/lib.rs
+++ b/src/elastic/src/lib.rs
@@ -56,16 +56,19 @@ The builder allows you to configure default parameters for all requests:
 
 ```no_run
 # extern crate elastic;
+# use elastic::prelude::*;
+# use std::str::FromStr;
 # fn main() { run().unwrap() }
 # fn run() -> Result<(), Box<::std::error::Error>> {
-use elastic::prelude::*;
-use elastic::http::header::Authorization;
+use elastic::http::header::{self, AUTHORIZATION, HeaderValue};
+
+let auth = HeaderValue::from_str("let me in")?;
 
 let builder = SyncClientBuilder::new()
     .static_node("http://es_host:9200")
-    .params_fluent(|p| p
+    .params_fluent(move |p| p
         .url_param("pretty", true)
-        .header(Authorization("let me in".to_owned())));
+        .header(AUTHORIZATION, auth.clone()));
 
 let client = builder.build()?;
 # Ok(())
@@ -279,7 +282,7 @@ This crate glues these libraries together with some simple assumptions about how
 */
 
 //#![deny(warnings, missing_docs)]
-#![allow(unknown_lints, doc_markdown)]
+#![allow(unknown_lints)]
 
 extern crate bytes;
 extern crate elastic_requests;
@@ -290,22 +293,20 @@ extern crate error_chain;
 extern crate fluent_builder;
 #[macro_use]
 extern crate futures;
-extern crate futures_cpupool;
+extern crate tokio_threadpool;
 #[macro_use]
 extern crate log;
 #[macro_use]
 extern crate quick_error;
-extern crate reqwest;
 extern crate crossbeam_channel as channel;
+extern crate reqwest;
 extern crate serde;
 #[macro_use]
 extern crate serde_derive;
 #[cfg_attr(test, macro_use)]
 extern crate serde_json;
-extern crate tokio_core;
-extern crate tokio_io;
+extern crate tokio;
 extern crate url;
-extern crate tokio_timer;
 extern crate uuid;
 
 #[cfg(test)]
@@ -319,8 +320,8 @@ mod private {
     pub trait Sealed {}
 }
 
-pub mod http;
 pub mod client;
+pub mod http;
 pub mod types;
 
 pub mod prelude {
diff --git a/src/elastic/src/types.rs b/src/elastic/src/types.rs
index 93b537c6ce..4e40c7cf23 100644
--- a/src/elastic/src/types.rs
+++ b/src/elastic/src/types.rs
@@ -67,7 +67,7 @@ that type is provided (like `Date`, which implements `Deref<Target = chrono::Dat
 
 ## Formats
 
-For some types (like `Date`), it's helpful to have an extra generic parameter that describes the way the data can be interpreted. 
+For some types (like `Date`), it's helpful to have an extra generic parameter that describes the way the data can be interpreted.
 For most types the format isn't exposed, because there aren't any alternative formats available.
 This is a particularly helpful feature for serialisation.
 
@@ -264,7 +264,16 @@ Serialising `MyType`s mapping will produce the following json:
 [geoshape-mod]: geo/shape/index.html
 */
 
-pub use elastic_types::{boolean, date, document, geo, ip, number, prelude, string};
+pub use elastic_types::{
+    boolean,
+    date,
+    document,
+    geo,
+    ip,
+    number,
+    prelude,
+    string,
+};
 
 pub(crate) const DEFAULT_TYPE: &'static str = "doc";
 
diff --git a/src/elastic_derive/src/lib.rs b/src/elastic_derive/src/lib.rs
index 193014a951..e0f8db7cc0 100644
--- a/src/elastic_derive/src/lib.rs
+++ b/src/elastic_derive/src/lib.rs
@@ -13,7 +13,10 @@ extern crate elastic_types_derive_internals as internals;
 extern crate quote;
 extern crate syn;
 
-use internals::{date_format, elastic_type};
+use internals::{
+    date_format,
+    elastic_type,
+};
 
 #[proc_macro_derive(ElasticType, attributes(elastic))]
 pub fn derive_elastic_type(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
diff --git a/src/queries/samples/Cargo.toml b/src/queries/samples/Cargo.toml
deleted file mode 100644
index 93583ed6f1..0000000000
--- a/src/queries/samples/Cargo.toml
+++ /dev/null
@@ -1,4 +0,0 @@
-[workspace]
-members = [
-	"search",
-]
\ No newline at end of file
diff --git a/src/queries/samples/search/.gitignore b/src/queries/samples/search/.gitignore
deleted file mode 100644
index ab22063e16..0000000000
--- a/src/queries/samples/search/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/target/
-/obj/
\ No newline at end of file
diff --git a/src/queries/samples/search/Cargo.toml b/src/queries/samples/search/Cargo.toml
deleted file mode 100644
index 2b27fb9f9b..0000000000
--- a/src/queries/samples/search/Cargo.toml
+++ /dev/null
@@ -1,27 +0,0 @@
-[package]
-name = "search"
-version = "0.0.0"
-authors = ["Stephan Buys <stephan.buys@panoptix.co.za>"]
-
-[dependencies]
-elastic_queries = { path = "../../" }
-env_logger = "0.6"
-futures = "0.1.15"
-futures-cpupool = "0.1.5"
-serde = "~1"
-serde_derive = "~1"
-serde_json = "~1"
-tokio-core = "0.1.9"
-
-[dependencies.timestrings]
-git = "https://github.com/stephanbuys/timestrings.git"
-version = "*"
-
-[dependencies.elastic]
-path = "../../../../src/elastic/"
-version = "*"
-
-[dependencies.elastic_derive]
-path = "../../../../src/elastic_derive/"
-version = "*"
-
diff --git a/src/queries/samples/search/src/main.rs b/src/queries/samples/search/src/main.rs
deleted file mode 100644
index efa132598a..0000000000
--- a/src/queries/samples/search/src/main.rs
+++ /dev/null
@@ -1,78 +0,0 @@
-#![feature(ip)]
-
-extern crate env_logger;
-extern crate serde;
-#[macro_use]
-extern crate serde_json;
-#[macro_use]
-extern crate serde_derive;
-extern crate elastic;
-extern crate timestrings;
-extern crate futures;
-extern crate tokio_core;
-extern crate futures_cpupool;
-extern crate elastic_queries;
-
-use std::error::Error;
-use futures::Future;
-use tokio_core::reactor::Core;
-use futures_cpupool::CpuPool;
-use elastic::prelude::*;
-
-use serde_json::Value;
-use timestrings::ts;
-use elastic_queries::prelude::*;
-
-fn run() -> Result<(), Box<Error>> {
-    let mut core = Core::new()?;
-    let pool = CpuPool::new(4);
-
-    let client = AsyncClientBuilder::new().serde_pool(pool).build(
-        &core.handle(),
-    )?;
-
-    let gte = ts("now-1d").unwrap();
-    let lte = ts("now").unwrap();
-
-    let mut query = QueryBuilder::default()
-        .size(Some(10))
-        .build()
-        .expect("could not build query");
-
-    let f = RangeFilter::new("@timestamp",
-                     RangeParamsBuilder::default()
-                         .gte(Some(gte.into()))
-                         .lte(Some(lte.into()))
-                         .format(Some(EsDateFormat::epoch_second))
-                         .build()
-                         .unwrap()
-    );
-
-    query.add_filter(BoolQuerySections::Must,
-                     f.into());
-
-    let res_future = client
-        .search::<Value>()
-        .index("_all")
-        .body(query.to_string()?)
-        .send();
-
-
-    let search_future = res_future.and_then(|res| {
-        // Iterate through the hits in the response.
-        for hit in res.hits() {
-            println!("{:?}", hit);
-        }
-
-        Ok(())
-    });
-
-    core.run(search_future)?;
-
-    Ok(())
-}
-
-fn main() {
-    env_logger::init();
-    run().unwrap()
-}
diff --git a/src/queries/src/aggregations/date_histogram.rs b/src/queries/src/aggregations/date_histogram.rs
index 365fd49b04..930aa41e70 100644
--- a/src/queries/src/aggregations/date_histogram.rs
+++ b/src/queries/src/aggregations/date_histogram.rs
@@ -1,11 +1,12 @@
-use std::collections::HashMap;
 use super::BucketAggregation;
 use super::EsAggregation;
+use std::collections::HashMap;
 
 #[derive(Clone, Debug, Serialize, Deserialize)]
 pub struct DateHistogramAggregation {
     pub date_histogram: DateHistogramFields,
-    #[serde(skip_serializing_if = "Option::is_none")] pub aggs: Option<EsAggregation>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub aggs: Option<EsAggregation>,
 }
 
 #[derive(Clone, Debug, Serialize, Deserialize)]
diff --git a/src/queries/src/aggregations/mod.rs b/src/queries/src/aggregations/mod.rs
index 24d0bf44b4..01a89cc45a 100644
--- a/src/queries/src/aggregations/mod.rs
+++ b/src/queries/src/aggregations/mod.rs
@@ -1,13 +1,17 @@
 pub(crate) mod date_histogram;
-pub(crate) mod terms;
 pub(crate) mod stats;
+pub(crate) mod terms;
 
-use std::option::Option;
-use std::collections::HashMap;
 use self::date_histogram::DateHistogramAggregation;
+use self::stats::{
+    AvgAggregation,
+    MaxAggregation,
+    SumAggregation,
+};
 use self::terms::TermAggregation;
-use self::stats::{AvgAggregation, MaxAggregation, SumAggregation};
 use std::collections::hash_map::Iter;
+use std::collections::HashMap;
+use std::option::Option;
 
 #[derive(Clone, Debug, Serialize, Deserialize)]
 #[serde(untagged)]
@@ -172,8 +176,8 @@ pub trait BucketAggregation {
     where
         F: Fn(&str, &mut Aggregation),
     {
-        use Aggregation::*;
         use aggregations::BucketAggregation;
+        use Aggregation::*;
         if let Some(a) = self.aggs_mut() {
             for (name, child) in a {
                 f(name, child);
@@ -284,9 +288,9 @@ impl<'i> Iterator for AggregationIterator<'i> {
 
 #[cfg(test)]
 mod tests {
+    use super::super::Query;
     use super::*;
     use serde_json;
-    use super::super::Query;
 
     #[test]
     fn api_replace() {
@@ -309,16 +313,15 @@ mod tests {
 
         s1.replace_target_agg("Agg3Terms", "AggNew", Aggregation::term(t));
 
-        assert!(
-            s1.aggs_get("Agg2Terms")
-                .unwrap()
-                .aggs_get("AggNew")
-                .unwrap()
-                .aggs_get("Agg4Terms")
-                .unwrap()
-                .aggs()
-                .is_some()
-        );
+        assert!(s1
+            .aggs_get("Agg2Terms")
+            .unwrap()
+            .aggs_get("AggNew")
+            .unwrap()
+            .aggs_get("Agg4Terms")
+            .unwrap()
+            .aggs()
+            .is_some());
     }
 
     #[test]
@@ -331,21 +334,19 @@ mod tests {
 
         s1.drop_target_agg("Agg3Terms");
 
-        assert!(
-            s1.aggs_get("Agg2Terms")
-                .unwrap()
-                .aggs_get("Agg3Terms")
-                .is_none()
-        );
-
-        assert!(
-            s1.aggs_get("Agg2Terms")
-                .unwrap()
-                .aggs_get("Agg4Terms")
-                .unwrap()
-                .aggs()
-                .is_some()
-        );
+        assert!(s1
+            .aggs_get("Agg2Terms")
+            .unwrap()
+            .aggs_get("Agg3Terms")
+            .is_none());
+
+        assert!(s1
+            .aggs_get("Agg2Terms")
+            .unwrap()
+            .aggs_get("Agg4Terms")
+            .unwrap()
+            .aggs()
+            .is_some());
     }
 
     #[test]
@@ -368,22 +369,21 @@ mod tests {
         use aggregations::terms::*;
 
         s1.insert_child_after("Agg2Terms", "AggNew", Aggregation::term(t));
-        assert!(
-            s1.aggs_get("Agg2Terms")
-                .unwrap()
-                .aggs_get("AggNew")
-                .unwrap()
-                .aggs_get("Agg3Terms")
-                .unwrap()
-                .aggs()
-                .is_some()
-        );
+        assert!(s1
+            .aggs_get("Agg2Terms")
+            .unwrap()
+            .aggs_get("AggNew")
+            .unwrap()
+            .aggs_get("Agg3Terms")
+            .unwrap()
+            .aggs()
+            .is_some());
     }
 
     #[test]
     fn find_and_insert_hard_way() {
-        use Aggregation::*;
         use aggregations::terms::TermsAggFields;
+        use Aggregation::*;
 
         let j = include_str!("../../tests/complex.json");
         let mut s1: Query = serde_json::from_str(j).unwrap();
diff --git a/src/queries/src/aggregations/terms.rs b/src/queries/src/aggregations/terms.rs
index 06be7326f4..53afe49fca 100644
--- a/src/queries/src/aggregations/terms.rs
+++ b/src/queries/src/aggregations/terms.rs
@@ -1,12 +1,13 @@
-use std::collections::HashMap;
+use super::super::filters::common::*;
 use super::BucketAggregation;
 use super::EsAggregation;
-use super::super::filters::common::*;
+use std::collections::HashMap;
 
 #[derive(Clone, Debug, Serialize, Deserialize)]
 pub struct TermAggregation {
     pub terms: TermsAggFields,
-    #[serde(skip_serializing_if = "Option::is_none")] pub aggs: Option<EsAggregation>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub aggs: Option<EsAggregation>,
 }
 
 #[derive(Clone, Debug, Serialize, Deserialize)]
diff --git a/src/queries/src/filters/common.rs b/src/queries/src/filters/common.rs
index 17433d5a6a..0705101e38 100644
--- a/src/queries/src/filters/common.rs
+++ b/src/queries/src/filters/common.rs
@@ -1,8 +1,12 @@
+use super::super::Values;
 use serde;
 use serde::de::Visitor;
-use serde::ser::{Serialize, SerializeMap, Serializer};
+use serde::ser::{
+    Serialize,
+    SerializeMap,
+    Serializer,
+};
 use std::fmt;
-use super::super::Values;
 
 #[derive(Debug, Clone, Serialize, Deserialize, PartialOrd, PartialEq, Ord, Eq)]
 pub enum EsDateFormat {
@@ -10,7 +14,8 @@ pub enum EsDateFormat {
     epoch_second,    //epoch in s
     basic_date,      //yyyyMMdd
     basic_date_time, //yyyyMMdd'T'HHmmss.SSSZ
-    #[doc(hidden)] __Nonexhaustive,
+    #[doc(hidden)]
+    __Nonexhaustive,
 }
 
 #[derive(Clone, Debug, Serialize, Deserialize, Ord, PartialOrd, Eq, PartialEq)]
diff --git a/src/queries/src/filters/matchfilter.rs b/src/queries/src/filters/matchfilter.rs
index 0ad821677d..b5c2604b4d 100644
--- a/src/queries/src/filters/matchfilter.rs
+++ b/src/queries/src/filters/matchfilter.rs
@@ -2,7 +2,8 @@ use super::common::*;
 
 #[derive(Clone, Debug, Serialize, Deserialize, Ord, PartialOrd, Eq, PartialEq)]
 pub struct MatchFilter {
-    #[serde(rename = "match")] pub match_: FieldAndValue,
+    #[serde(rename = "match")]
+    pub match_: FieldAndValue,
 }
 
 #[cfg(test)]
diff --git a/src/queries/src/filters/mod.rs b/src/queries/src/filters/mod.rs
index a44f6ec309..87970c382f 100644
--- a/src/queries/src/filters/mod.rs
+++ b/src/queries/src/filters/mod.rs
@@ -18,7 +18,8 @@ pub enum Filters {
     term(TermFilter),
     range(RangeFilter),
     exists(ExistsFilter),
-    #[serde(rename = "match")] match_(MatchFilter),
+    #[serde(rename = "match")]
+    match_(MatchFilter),
     wildcard(WildcardFilter),
 }
 
diff --git a/src/queries/src/filters/range.rs b/src/queries/src/filters/range.rs
index 6be36aa826..4becaded1a 100644
--- a/src/queries/src/filters/range.rs
+++ b/src/queries/src/filters/range.rs
@@ -1,9 +1,13 @@
+use super::super::Values;
+use super::common::EsDateFormat;
 use serde;
 use serde::de::Visitor;
-use serde::ser::{Serialize, SerializeMap, Serializer};
+use serde::ser::{
+    Serialize,
+    SerializeMap,
+    Serializer,
+};
 use std::fmt;
-use super::super::Values;
-use super::common::EsDateFormat;
 
 //FIXME: Implement builder pattern for RangeFilter
 #[derive(Clone, Debug, Serialize, Deserialize, Ord, PartialOrd, Eq, PartialEq)]
diff --git a/src/queries/src/filters/term.rs b/src/queries/src/filters/term.rs
index 45f24d70cb..4de8ebe4d0 100644
--- a/src/queries/src/filters/term.rs
+++ b/src/queries/src/filters/term.rs
@@ -1,5 +1,5 @@
-use super::super::Values;
 use super::super::filters::common::*;
+use super::super::Values;
 
 #[derive(Clone, Debug, Serialize, Deserialize, Ord, PartialOrd, Eq, PartialEq)]
 pub struct TermFilter {
diff --git a/src/queries/src/lib.rs b/src/queries/src/lib.rs
index 18d2b29ece..290e5590fd 100644
--- a/src/queries/src/lib.rs
+++ b/src/queries/src/lib.rs
@@ -15,11 +15,11 @@ mod aggregations;
 mod filters;
 pub mod prelude;
 
-use std::collections::HashMap;
-use filters::Filters;
 use aggregations::Aggregation;
 use aggregations::BucketAggregation;
 use aggregations::EsAggregation;
+use filters::Filters;
+use std::collections::HashMap;
 
 #[derive(Clone, Debug, Serialize, Deserialize, Ord, PartialOrd, Eq, PartialEq)]
 #[serde(untagged)]
@@ -63,34 +63,42 @@ impl Bool {
         use BoolQuerySections::*;
 
         match section {
-            Must => if let Some(ref mut ve) = self.must {
-                if let Err(i) = ve.binary_search(&f) {
-                    ve.insert(i, f);
+            Must => {
+                if let Some(ref mut ve) = self.must {
+                    if let Err(i) = ve.binary_search(&f) {
+                        ve.insert(i, f);
+                    }
+                } else {
+                    self.must = Some(vec![f]);
                 }
-            } else {
-                self.must = Some(vec![f]);
-            },
-            Should => if let Some(ref mut ve) = self.should {
-                if let Err(i) = ve.binary_search(&f) {
-                    ve.insert(i, f);
+            }
+            Should => {
+                if let Some(ref mut ve) = self.should {
+                    if let Err(i) = ve.binary_search(&f) {
+                        ve.insert(i, f);
+                    }
+                } else {
+                    self.should = Some(vec![f]);
                 }
-            } else {
-                self.should = Some(vec![f]);
-            },
-            Filter => if let Some(ref mut ve) = self.filter {
-                if let Err(i) = ve.binary_search(&f) {
-                    ve.insert(i, f);
+            }
+            Filter => {
+                if let Some(ref mut ve) = self.filter {
+                    if let Err(i) = ve.binary_search(&f) {
+                        ve.insert(i, f);
+                    }
+                } else {
+                    self.filter = Some(vec![f]);
                 }
-            } else {
-                self.filter = Some(vec![f]);
-            },
-            MustNot => if let Some(ref mut ve) = self.must_not {
-                if let Err(i) = ve.binary_search(&f) {
-                    ve.insert(i, f);
+            }
+            MustNot => {
+                if let Some(ref mut ve) = self.must_not {
+                    if let Err(i) = ve.binary_search(&f) {
+                        ve.insert(i, f);
+                    }
+                } else {
+                    self.must_not = Some(vec![f]);
                 }
-            } else {
-                self.must_not = Some(vec![f]);
-            },
+            }
         }
     }
 
@@ -98,41 +106,50 @@ impl Bool {
         use BoolQuerySections::*;
 
         match section {
-            Must => if let Some(ref mut ve) = self.must {
-                if let Ok(i) = ve.binary_search(&f) {
-                    ve.remove(i);
+            Must => {
+                if let Some(ref mut ve) = self.must {
+                    if let Ok(i) = ve.binary_search(&f) {
+                        ve.remove(i);
+                    }
+                } else {
+                    self.must = Some(vec![f]);
                 }
-            } else {
-                self.must = Some(vec![f]);
-            },
-            Should => if let Some(ref mut ve) = self.should {
-                if let Ok(i) = ve.binary_search(&f) {
-                    ve.remove(i);
+            }
+            Should => {
+                if let Some(ref mut ve) = self.should {
+                    if let Ok(i) = ve.binary_search(&f) {
+                        ve.remove(i);
+                    }
+                } else {
+                    self.should = Some(vec![f]);
                 }
-            } else {
-                self.should = Some(vec![f]);
-            },
-            Filter => if let Some(ref mut ve) = self.filter {
-                if let Ok(i) = ve.binary_search(&f) {
-                    ve.remove(i);
+            }
+            Filter => {
+                if let Some(ref mut ve) = self.filter {
+                    if let Ok(i) = ve.binary_search(&f) {
+                        ve.remove(i);
+                    }
+                } else {
+                    self.filter = Some(vec![f]);
                 }
-            } else {
-                self.filter = Some(vec![f]);
-            },
-            MustNot => if let Some(ref mut ve) = self.must_not {
-                if let Ok(i) = ve.binary_search(&f) {
-                    ve.remove(i);
+            }
+            MustNot => {
+                if let Some(ref mut ve) = self.must_not {
+                    if let Ok(i) = ve.binary_search(&f) {
+                        ve.remove(i);
+                    }
+                } else {
+                    self.must_not = Some(vec![f]);
                 }
-            } else {
-                self.must_not = Some(vec![f]);
-            },
+            }
         }
     }
 }
 
 #[derive(Builder, Clone, Debug, Serialize, Deserialize)]
 pub struct QueryField {
-    #[builder(default = "self.default_bool()?")] pub bool: Bool,
+    #[builder(default = "self.default_bool()?")]
+    pub bool: Bool,
 }
 
 impl QueryFieldBuilder {
@@ -214,7 +231,12 @@ impl Query {
     }
 
     /// Add new Aggregation shifting current Aggregations down.
-    fn insert_child_after_internal(&mut self, target: &str, child: &str, agg: Aggregation) -> Option<aggregations::EsAggregation> {
+    fn insert_child_after_internal(
+        &mut self,
+        target: &str,
+        child: &str,
+        agg: Aggregation,
+    ) -> Option<aggregations::EsAggregation> {
         if let Some(root_aggs) = self.aggs_mut() {
             let mut returnable = HashMap::new();
 
@@ -241,9 +263,11 @@ impl Query {
                 //Add the stored sub-children back
                 if let Some(newchild) = root.aggs_get(child) {
                     match out {
-                        Some(a) => for (name, key) in a {
-                            newchild.add_child(name, key.clone());
-                        },
+                        Some(a) => {
+                            for (name, key) in a {
+                                newchild.add_child(name, key.clone());
+                            }
+                        }
                         None => (),
                     };
                 }
@@ -309,8 +333,8 @@ impl QueryBuilder {
 
 #[cfg(test)]
 mod tests {
-    use super::*;
     use super::filters::*;
+    use super::*;
 
     #[test]
     fn root_to_target() {
@@ -394,7 +418,8 @@ mod tests {
         );
 
         let j = serde_json::to_string(&q).unwrap();
-        let expected = r#"{"query":{"bool":{"must":[{"term":{"foo":1}}],"must_not":[{"term":{"foo":1}}]}}}"#;
+        let expected =
+            r#"{"query":{"bool":{"must":[{"term":{"foo":1}}],"must_not":[{"term":{"foo":1}}]}}}"#;
         assert_eq!(expected, j);
     }
 
diff --git a/src/queries/src/prelude.rs b/src/queries/src/prelude.rs
index 2e2060490e..0d7b409413 100644
--- a/src/queries/src/prelude.rs
+++ b/src/queries/src/prelude.rs
@@ -1,5 +1,8 @@
+pub use filters::common::EsDateFormat;
+pub use filters::range::{
+    RangeFilter,
+    RangeParamsBuilder,
+};
 pub use BoolQuerySections;
 pub use Query;
 pub use QueryBuilder;
-pub use filters::common::EsDateFormat;
-pub use filters::range::{RangeFilter, RangeParamsBuilder};
diff --git a/src/requests/benches/mod.rs b/src/requests/benches/mod.rs
index 79f4d40a81..fdecbec38b 100644
--- a/src/requests/benches/mod.rs
+++ b/src/requests/benches/mod.rs
@@ -9,7 +9,8 @@ use test::Bencher;
 #[bench]
 fn new_req(b: &mut Bencher) {
     b.iter(|| {
-        let req = SearchRequest::for_index_ty("test_index", "test_ty", "{'query': { 'match_all': {}}}");
+        let req =
+            SearchRequest::for_index_ty("test_index", "test_ty", "{'query': { 'match_all': {}}}");
 
         test::black_box(req)
     });
@@ -18,7 +19,8 @@ fn new_req(b: &mut Bencher) {
 #[bench]
 fn owned_req_into_http_req(b: &mut Bencher) {
     b.iter(|| {
-        let req = SearchRequest::for_index_ty("test_index", "test_ty", "{'query': { 'match_all': {}}}");
+        let req =
+            SearchRequest::for_index_ty("test_index", "test_ty", "{'query': { 'match_all': {}}}");
 
         let http_req: Endpoint<_> = (req).into();
 
diff --git a/src/requests/src/genned.rs b/src/requests/src/genned.rs
index 351b2f0216..d17eccf370 100644
--- a/src/requests/src/genned.rs
+++ b/src/requests/src/genned.rs
@@ -249,7 +249,9 @@ pub mod endpoints {
     impl ScriptsPainlessExecuteUrlParams {
         pub fn url<'a>(self) -> UrlPath<'a> {
             match self {
-                ScriptsPainlessExecuteUrlParams::None => UrlPath::from("/_scripts/painless/_execute"),
+                ScriptsPainlessExecuteUrlParams::None => {
+                    UrlPath::from("/_scripts/painless/_execute")
+                }
             }
         }
     }
@@ -485,7 +487,9 @@ pub mod endpoints {
     impl<'a> TasksListRequest<'a> {
         #[doc = "Request to: `/_tasks`"]
         pub fn new() -> Self {
-            TasksListRequest { url: TasksListUrlParams::None.url() }
+            TasksListRequest {
+                url: TasksListUrlParams::None.url(),
+            }
         }
     }
     impl<'a> Into<Endpoint<'a, DefaultBody>> for TasksListRequest<'a> {
@@ -656,7 +660,9 @@ pub mod endpoints {
     impl<'a> ClusterStatsRequest<'a> {
         #[doc = "Request to: `/_cluster/stats`"]
         pub fn new() -> Self {
-            ClusterStatsRequest { url: ClusterStatsUrlParams::None.url() }
+            ClusterStatsRequest {
+                url: ClusterStatsUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_cluster/stats/nodes/{node_id}`"]
         pub fn for_node_id<INodeId>(node_id: INodeId) -> Self
@@ -796,7 +802,10 @@ pub mod endpoints {
     impl<'a, B> MgetRequest<'a, B> {
         #[doc = "Request to: `/_mget`"]
         pub fn new(body: B) -> Self {
-            MgetRequest { url: MgetUrlParams::None.url(), body: body }
+            MgetRequest {
+                url: MgetUrlParams::None.url(),
+                body: body,
+            }
         }
         #[doc = "Request to: `/{index}/_mget`"]
         pub fn for_index<IIndex>(index: IIndex, body: B) -> Self
@@ -913,7 +922,9 @@ pub mod endpoints {
     impl<'a> ClusterRemoteInfoRequest<'a> {
         #[doc = "Request to: `/_remote/info`"]
         pub fn new() -> Self {
-            ClusterRemoteInfoRequest { url: ClusterRemoteInfoUrlParams::None.url() }
+            ClusterRemoteInfoRequest {
+                url: ClusterRemoteInfoUrlParams::None.url(),
+            }
         }
     }
     impl<'a> Into<Endpoint<'a, DefaultBody>> for ClusterRemoteInfoRequest<'a> {
@@ -944,7 +955,9 @@ pub mod endpoints {
     impl<'a> CatHealthRequest<'a> {
         #[doc = "Request to: `/_cat/health`"]
         pub fn new() -> Self {
-            CatHealthRequest { url: CatHealthUrlParams::None.url() }
+            CatHealthRequest {
+                url: CatHealthUrlParams::None.url(),
+            }
         }
     }
     impl<'a> Into<Endpoint<'a, DefaultBody>> for CatHealthRequest<'a> {
@@ -1162,7 +1175,10 @@ pub mod endpoints {
     impl<'a, B> ScrollRequest<'a, B> {
         #[doc = "Request to: `/_search/scroll`"]
         pub fn new(body: B) -> Self {
-            ScrollRequest { url: ScrollUrlParams::None.url(), body: body }
+            ScrollRequest {
+                url: ScrollUrlParams::None.url(),
+                body: body,
+            }
         }
         #[doc = "Request to: `/_search/scroll/{scroll_id}`"]
         pub fn for_scroll_id<IScrollId>(scroll_id: IScrollId, body: B) -> Self
@@ -1305,7 +1321,8 @@ pub mod endpoints {
         pub fn url(self) -> UrlPath<'a> {
             match self {
                 SnapshotCreateUrlParams::RepositorySnapshot(ref repository, ref snapshot) => {
-                    let mut url = String::with_capacity(12usize + repository.len() + snapshot.len());
+                    let mut url =
+                        String::with_capacity(12usize + repository.len() + snapshot.len());
                     url.push_str("/_snapshot/");
                     url.push_str(repository.as_ref());
                     url.push_str("/");
@@ -1323,13 +1340,21 @@ pub mod endpoints {
     }
     impl<'a, B> SnapshotCreateRequest<'a, B> {
         #[doc = "Request to: `/_snapshot/{repository}/{snapshot}`"]
-        pub fn for_repository_snapshot<IRepository, ISnapshot>(repository: IRepository, snapshot: ISnapshot, body: B) -> Self
+        pub fn for_repository_snapshot<IRepository, ISnapshot>(
+            repository: IRepository,
+            snapshot: ISnapshot,
+            body: B,
+        ) -> Self
         where
             IRepository: Into<Repository<'a>>,
             ISnapshot: Into<Snapshot<'a>>,
         {
             SnapshotCreateRequest {
-                url: SnapshotCreateUrlParams::RepositorySnapshot(repository.into(), snapshot.into()).url(),
+                url: SnapshotCreateUrlParams::RepositorySnapshot(
+                    repository.into(),
+                    snapshot.into(),
+                )
+                .url(),
                 body: body,
             }
         }
@@ -1430,7 +1455,9 @@ pub mod endpoints {
     impl<'a> IndicesGetMappingRequest<'a> {
         #[doc = "Request to: `/_mapping`"]
         pub fn new() -> Self {
-            IndicesGetMappingRequest { url: IndicesGetMappingUrlParams::None.url() }
+            IndicesGetMappingRequest {
+                url: IndicesGetMappingUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/{index}/_mapping`"]
         pub fn for_index<IIndex>(index: IIndex) -> Self
@@ -1508,7 +1535,10 @@ pub mod endpoints {
     impl<'a, B> BulkRequest<'a, B> {
         #[doc = "Request to: `/_bulk`"]
         pub fn new(body: B) -> Self {
-            BulkRequest { url: BulkUrlParams::None.url(), body: body }
+            BulkRequest {
+                url: BulkUrlParams::None.url(),
+                body: body,
+            }
         }
         #[doc = "Request to: `/{index}/_bulk`"]
         pub fn for_index<IIndex>(index: IIndex, body: B) -> Self
@@ -1567,7 +1597,9 @@ pub mod endpoints {
     impl<'a> ClusterHealthRequest<'a> {
         #[doc = "Request to: `/_cluster/health`"]
         pub fn new() -> Self {
-            ClusterHealthRequest { url: ClusterHealthUrlParams::None.url() }
+            ClusterHealthRequest {
+                url: ClusterHealthUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_cluster/health/{index}`"]
         pub fn for_index<IIndex>(index: IIndex) -> Self
@@ -1614,7 +1646,9 @@ pub mod endpoints {
     impl<'a> CatAliasesRequest<'a> {
         #[doc = "Request to: `/_cat/aliases`"]
         pub fn new() -> Self {
-            CatAliasesRequest { url: CatAliasesUrlParams::None.url() }
+            CatAliasesRequest {
+                url: CatAliasesUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_cat/aliases/{name}`"]
         pub fn for_name<IName>(name: IName) -> Self
@@ -1661,7 +1695,9 @@ pub mod endpoints {
     impl<'a> CatSegmentsRequest<'a> {
         #[doc = "Request to: `/_cat/segments`"]
         pub fn new() -> Self {
-            CatSegmentsRequest { url: CatSegmentsUrlParams::None.url() }
+            CatSegmentsRequest {
+                url: CatSegmentsUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_cat/segments/{index}`"]
         pub fn for_index<IIndex>(index: IIndex) -> Self
@@ -1719,7 +1755,9 @@ pub mod endpoints {
     impl<'a> SimpleSearchRequest<'a> {
         #[doc = "Request to: `/_search`"]
         pub fn new() -> Self {
-            SimpleSearchRequest { url: SimpleSearchUrlParams::None.url() }
+            SimpleSearchRequest {
+                url: SimpleSearchUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/{index}/_search`"]
         pub fn for_index<IIndex>(index: IIndex) -> Self
@@ -1788,7 +1826,10 @@ pub mod endpoints {
     impl<'a, B> SearchRequest<'a, B> {
         #[doc = "Request to: `/_search`"]
         pub fn new(body: B) -> Self {
-            SearchRequest { url: SearchUrlParams::None.url(), body: body }
+            SearchRequest {
+                url: SearchUrlParams::None.url(),
+                body: body,
+            }
         }
         #[doc = "Request to: `/{index}/_search`"]
         pub fn for_index<IIndex>(index: IIndex, body: B) -> Self
@@ -1840,7 +1881,9 @@ pub mod endpoints {
     impl<'a> ClusterPendingTasksRequest<'a> {
         #[doc = "Request to: `/_cluster/pending_tasks`"]
         pub fn new() -> Self {
-            ClusterPendingTasksRequest { url: ClusterPendingTasksUrlParams::None.url() }
+            ClusterPendingTasksRequest {
+                url: ClusterPendingTasksUrlParams::None.url(),
+            }
         }
     }
     impl<'a> Into<Endpoint<'a, DefaultBody>> for ClusterPendingTasksRequest<'a> {
@@ -1860,7 +1903,8 @@ pub mod endpoints {
         pub fn url(self) -> UrlPath<'a> {
             match self {
                 ExistsSourceUrlParams::IndexTypeId(ref index, ref ty, ref id) => {
-                    let mut url = String::with_capacity(11usize + index.len() + ty.len() + id.len());
+                    let mut url =
+                        String::with_capacity(11usize + index.len() + ty.len() + id.len());
                     url.push_str("/");
                     url.push_str(index.as_ref());
                     url.push_str("/");
@@ -1926,10 +1970,14 @@ pub mod endpoints {
     impl<'a> CatThreadPoolRequest<'a> {
         #[doc = "Request to: `/_cat/thread_pool`"]
         pub fn new() -> Self {
-            CatThreadPoolRequest { url: CatThreadPoolUrlParams::None.url() }
+            CatThreadPoolRequest {
+                url: CatThreadPoolUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_cat/thread_pool/{thread_pool_patterns}`"]
-        pub fn for_thread_pool_patterns<IThreadPoolPatterns>(thread_pool_patterns: IThreadPoolPatterns) -> Self
+        pub fn for_thread_pool_patterns<IThreadPoolPatterns>(
+            thread_pool_patterns: IThreadPoolPatterns,
+        ) -> Self
         where
             IThreadPoolPatterns: Into<ThreadPoolPatterns<'a>>,
         {
@@ -1999,7 +2047,8 @@ pub mod endpoints {
         pub fn url(self) -> UrlPath<'a> {
             match self {
                 ExplainUrlParams::IndexTypeId(ref index, ref ty, ref id) => {
-                    let mut url = String::with_capacity(12usize + index.len() + ty.len() + id.len());
+                    let mut url =
+                        String::with_capacity(12usize + index.len() + ty.len() + id.len());
                     url.push_str("/");
                     url.push_str(index.as_ref());
                     url.push_str("/");
@@ -2020,7 +2069,12 @@ pub mod endpoints {
     }
     impl<'a, B> ExplainRequest<'a, B> {
         #[doc = "Request to: `/{index}/{type}/{id}/_explain`"]
-        pub fn for_index_ty_id<IIndex, IType, IId>(index: IIndex, ty: IType, id: IId, body: B) -> Self
+        pub fn for_index_ty_id<IIndex, IType, IId>(
+            index: IIndex,
+            ty: IType,
+            id: IId,
+            body: B,
+        ) -> Self
         where
             IIndex: Into<Index<'a>>,
             IType: Into<Type<'a>>,
@@ -2059,7 +2113,8 @@ pub mod endpoints {
                     UrlPath::from(url)
                 }
                 SnapshotStatusUrlParams::RepositorySnapshot(ref repository, ref snapshot) => {
-                    let mut url = String::with_capacity(20usize + repository.len() + snapshot.len());
+                    let mut url =
+                        String::with_capacity(20usize + repository.len() + snapshot.len());
                     url.push_str("/_snapshot/");
                     url.push_str(repository.as_ref());
                     url.push_str("/");
@@ -2078,7 +2133,9 @@ pub mod endpoints {
     impl<'a> SnapshotStatusRequest<'a> {
         #[doc = "Request to: `/_snapshot/_status`"]
         pub fn new() -> Self {
-            SnapshotStatusRequest { url: SnapshotStatusUrlParams::None.url() }
+            SnapshotStatusRequest {
+                url: SnapshotStatusUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_snapshot/{repository}/_status`"]
         pub fn for_repository<IRepository>(repository: IRepository) -> Self
@@ -2090,13 +2147,20 @@ pub mod endpoints {
             }
         }
         #[doc = "Request to: `/_snapshot/{repository}/{snapshot}/_status`"]
-        pub fn for_repository_snapshot<IRepository, ISnapshot>(repository: IRepository, snapshot: ISnapshot) -> Self
+        pub fn for_repository_snapshot<IRepository, ISnapshot>(
+            repository: IRepository,
+            snapshot: ISnapshot,
+        ) -> Self
         where
             IRepository: Into<Repository<'a>>,
             ISnapshot: Into<Snapshot<'a>>,
         {
             SnapshotStatusRequest {
-                url: SnapshotStatusUrlParams::RepositorySnapshot(repository.into(), snapshot.into()).url(),
+                url: SnapshotStatusUrlParams::RepositorySnapshot(
+                    repository.into(),
+                    snapshot.into(),
+                )
+                .url(),
             }
         }
     }
@@ -2225,7 +2289,9 @@ pub mod endpoints {
     impl<'a> CatTemplatesRequest<'a> {
         #[doc = "Request to: `/_cat/templates`"]
         pub fn new() -> Self {
-            CatTemplatesRequest { url: CatTemplatesUrlParams::None.url() }
+            CatTemplatesRequest {
+                url: CatTemplatesUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_cat/templates/{name}`"]
         pub fn for_name<IName>(name: IName) -> Self
@@ -2422,7 +2488,8 @@ pub mod endpoints {
                     UrlPath::from(url)
                 }
                 NodesStatsUrlParams::MetricIndexMetric(ref metric, ref index_metric) => {
-                    let mut url = String::with_capacity(15usize + metric.len() + index_metric.len());
+                    let mut url =
+                        String::with_capacity(15usize + metric.len() + index_metric.len());
                     url.push_str("/_nodes/stats/");
                     url.push_str(metric.as_ref());
                     url.push_str("/");
@@ -2444,8 +2511,14 @@ pub mod endpoints {
                     url.push_str(metric.as_ref());
                     UrlPath::from(url)
                 }
-                NodesStatsUrlParams::NodeIdMetricIndexMetric(ref node_id, ref metric, ref index_metric) => {
-                    let mut url = String::with_capacity(16usize + node_id.len() + metric.len() + index_metric.len());
+                NodesStatsUrlParams::NodeIdMetricIndexMetric(
+                    ref node_id,
+                    ref metric,
+                    ref index_metric,
+                ) => {
+                    let mut url = String::with_capacity(
+                        16usize + node_id.len() + metric.len() + index_metric.len(),
+                    );
                     url.push_str("/_nodes/");
                     url.push_str(node_id.as_ref());
                     url.push_str("/stats/");
@@ -2465,7 +2538,9 @@ pub mod endpoints {
     impl<'a> NodesStatsRequest<'a> {
         #[doc = "Request to: `/_nodes/stats`"]
         pub fn new() -> Self {
-            NodesStatsRequest { url: NodesStatsUrlParams::None.url() }
+            NodesStatsRequest {
+                url: NodesStatsUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_nodes/stats/{metric}`"]
         pub fn for_metric<IMetric>(metric: IMetric) -> Self
@@ -2477,13 +2552,17 @@ pub mod endpoints {
             }
         }
         #[doc = "Request to: `/_nodes/stats/{metric}/{index_metric}`"]
-        pub fn for_metric_index_metric<IMetric, IIndexMetric>(metric: IMetric, index_metric: IIndexMetric) -> Self
+        pub fn for_metric_index_metric<IMetric, IIndexMetric>(
+            metric: IMetric,
+            index_metric: IIndexMetric,
+        ) -> Self
         where
             IMetric: Into<Metric<'a>>,
             IIndexMetric: Into<IndexMetric<'a>>,
         {
             NodesStatsRequest {
-                url: NodesStatsUrlParams::MetricIndexMetric(metric.into(), index_metric.into()).url(),
+                url: NodesStatsUrlParams::MetricIndexMetric(metric.into(), index_metric.into())
+                    .url(),
             }
         }
         #[doc = "Request to: `/_nodes/{node_id}/stats`"]
@@ -2506,14 +2585,23 @@ pub mod endpoints {
             }
         }
         #[doc = "Request to: `/_nodes/{node_id}/stats/{metric}/{index_metric}`"]
-        pub fn for_node_id_metric_index_metric<INodeId, IMetric, IIndexMetric>(node_id: INodeId, metric: IMetric, index_metric: IIndexMetric) -> Self
+        pub fn for_node_id_metric_index_metric<INodeId, IMetric, IIndexMetric>(
+            node_id: INodeId,
+            metric: IMetric,
+            index_metric: IIndexMetric,
+        ) -> Self
         where
             INodeId: Into<NodeId<'a>>,
             IMetric: Into<Metric<'a>>,
             IIndexMetric: Into<IndexMetric<'a>>,
         {
             NodesStatsRequest {
-                url: NodesStatsUrlParams::NodeIdMetricIndexMetric(node_id.into(), metric.into(), index_metric.into()).url(),
+                url: NodesStatsUrlParams::NodeIdMetricIndexMetric(
+                    node_id.into(),
+                    metric.into(),
+                    index_metric.into(),
+                )
+                .url(),
             }
         }
     }
@@ -2552,7 +2640,9 @@ pub mod endpoints {
     impl<'a> CatSnapshotsRequest<'a> {
         #[doc = "Request to: `/_cat/snapshots`"]
         pub fn new() -> Self {
-            CatSnapshotsRequest { url: CatSnapshotsUrlParams::None.url() }
+            CatSnapshotsRequest {
+                url: CatSnapshotsUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_cat/snapshots/{repository}`"]
         pub fn for_repository<IRepository>(repository: IRepository) -> Self
@@ -2616,7 +2706,9 @@ pub mod endpoints {
     impl<'a> IndicesGetSettingsRequest<'a> {
         #[doc = "Request to: `/_settings`"]
         pub fn new() -> Self {
-            IndicesGetSettingsRequest { url: IndicesGetSettingsUrlParams::None.url() }
+            IndicesGetSettingsRequest {
+                url: IndicesGetSettingsUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/{index}/_settings`"]
         pub fn for_index<IIndex>(index: IIndex) -> Self
@@ -2906,7 +2998,9 @@ pub mod endpoints {
     impl<'a> CatPendingTasksRequest<'a> {
         #[doc = "Request to: `/_cat/pending_tasks`"]
         pub fn new() -> Self {
-            CatPendingTasksRequest { url: CatPendingTasksUrlParams::None.url() }
+            CatPendingTasksRequest {
+                url: CatPendingTasksUrlParams::None.url(),
+            }
         }
     }
     impl<'a> Into<Endpoint<'a, DefaultBody>> for CatPendingTasksRequest<'a> {
@@ -2944,7 +3038,9 @@ pub mod endpoints {
     impl<'a> IngestGetPipelineRequest<'a> {
         #[doc = "Request to: `/_ingest/pipeline`"]
         pub fn new() -> Self {
-            IngestGetPipelineRequest { url: IngestGetPipelineUrlParams::None.url() }
+            IngestGetPipelineRequest {
+                url: IngestGetPipelineUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_ingest/pipeline/{id}`"]
         pub fn for_id<IId>(id: IId) -> Self
@@ -2992,7 +3088,9 @@ pub mod endpoints {
     impl<'a> IndicesRecoveryRequest<'a> {
         #[doc = "Request to: `/_recovery`"]
         pub fn new() -> Self {
-            IndicesRecoveryRequest { url: IndicesRecoveryUrlParams::None.url() }
+            IndicesRecoveryRequest {
+                url: IndicesRecoveryUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/{index}/_recovery`"]
         pub fn for_index<IIndex>(index: IIndex) -> Self
@@ -3055,7 +3153,9 @@ pub mod endpoints {
     impl<'a> NodesInfoRequest<'a> {
         #[doc = "Request to: `/_nodes`"]
         pub fn new() -> Self {
-            NodesInfoRequest { url: NodesInfoUrlParams::None.url() }
+            NodesInfoRequest {
+                url: NodesInfoUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_nodes/{metric}`"]
         pub fn for_metric<IMetric>(metric: IMetric) -> Self
@@ -3103,7 +3203,8 @@ pub mod endpoints {
         pub fn url(self) -> UrlPath<'a> {
             match self {
                 SnapshotGetUrlParams::RepositorySnapshot(ref repository, ref snapshot) => {
-                    let mut url = String::with_capacity(12usize + repository.len() + snapshot.len());
+                    let mut url =
+                        String::with_capacity(12usize + repository.len() + snapshot.len());
                     url.push_str("/_snapshot/");
                     url.push_str(repository.as_ref());
                     url.push_str("/");
@@ -3120,13 +3221,17 @@ pub mod endpoints {
     }
     impl<'a> SnapshotGetRequest<'a> {
         #[doc = "Request to: `/_snapshot/{repository}/{snapshot}`"]
-        pub fn for_repository_snapshot<IRepository, ISnapshot>(repository: IRepository, snapshot: ISnapshot) -> Self
+        pub fn for_repository_snapshot<IRepository, ISnapshot>(
+            repository: IRepository,
+            snapshot: ISnapshot,
+        ) -> Self
         where
             IRepository: Into<Repository<'a>>,
             ISnapshot: Into<Snapshot<'a>>,
         {
             SnapshotGetRequest {
-                url: SnapshotGetUrlParams::RepositorySnapshot(repository.into(), snapshot.into()).url(),
+                url: SnapshotGetUrlParams::RepositorySnapshot(repository.into(), snapshot.into())
+                    .url(),
             }
         }
     }
@@ -3147,7 +3252,8 @@ pub mod endpoints {
         pub fn url(self) -> UrlPath<'a> {
             match self {
                 SnapshotRestoreUrlParams::RepositorySnapshot(ref repository, ref snapshot) => {
-                    let mut url = String::with_capacity(21usize + repository.len() + snapshot.len());
+                    let mut url =
+                        String::with_capacity(21usize + repository.len() + snapshot.len());
                     url.push_str("/_snapshot/");
                     url.push_str(repository.as_ref());
                     url.push_str("/");
@@ -3166,13 +3272,21 @@ pub mod endpoints {
     }
     impl<'a, B> SnapshotRestoreRequest<'a, B> {
         #[doc = "Request to: `/_snapshot/{repository}/{snapshot}/_restore`"]
-        pub fn for_repository_snapshot<IRepository, ISnapshot>(repository: IRepository, snapshot: ISnapshot, body: B) -> Self
+        pub fn for_repository_snapshot<IRepository, ISnapshot>(
+            repository: IRepository,
+            snapshot: ISnapshot,
+            body: B,
+        ) -> Self
         where
             IRepository: Into<Repository<'a>>,
             ISnapshot: Into<Snapshot<'a>>,
         {
             SnapshotRestoreRequest {
-                url: SnapshotRestoreUrlParams::RepositorySnapshot(repository.into(), snapshot.into()).url(),
+                url: SnapshotRestoreUrlParams::RepositorySnapshot(
+                    repository.into(),
+                    snapshot.into(),
+                )
+                .url(),
                 body: body,
             }
         }
@@ -3213,7 +3327,9 @@ pub mod endpoints {
     impl<'a> IndicesShardStoresRequest<'a> {
         #[doc = "Request to: `/_shard_stores`"]
         pub fn new() -> Self {
-            IndicesShardStoresRequest { url: IndicesShardStoresUrlParams::None.url() }
+            IndicesShardStoresRequest {
+                url: IndicesShardStoresUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/{index}/_shard_stores`"]
         pub fn for_index<IIndex>(index: IIndex) -> Self
@@ -3260,7 +3376,9 @@ pub mod endpoints {
     impl<'a> IndicesGetTemplateRequest<'a> {
         #[doc = "Request to: `/_template`"]
         pub fn new() -> Self {
-            IndicesGetTemplateRequest { url: IndicesGetTemplateUrlParams::None.url() }
+            IndicesGetTemplateRequest {
+                url: IndicesGetTemplateUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_template/{name}`"]
         pub fn for_name<IName>(name: IName) -> Self
@@ -3365,7 +3483,9 @@ pub mod endpoints {
     impl<'a> CatMasterRequest<'a> {
         #[doc = "Request to: `/_cat/master`"]
         pub fn new() -> Self {
-            CatMasterRequest { url: CatMasterUrlParams::None.url() }
+            CatMasterRequest {
+                url: CatMasterUrlParams::None.url(),
+            }
         }
     }
     impl<'a> Into<Endpoint<'a, DefaultBody>> for CatMasterRequest<'a> {
@@ -3404,7 +3524,9 @@ pub mod endpoints {
     impl<'a> NodesHotThreadsRequest<'a> {
         #[doc = "Request to: `/_nodes/hot_threads`"]
         pub fn new() -> Self {
-            NodesHotThreadsRequest { url: NodesHotThreadsUrlParams::None.url() }
+            NodesHotThreadsRequest {
+                url: NodesHotThreadsUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_nodes/{node_id}/hot_threads`"]
         pub fn for_node_id<INodeId>(node_id: INodeId) -> Self
@@ -3469,7 +3591,11 @@ pub mod endpoints {
             }
         }
         #[doc = "Request to: `/{alias}/_rollover/{new_index}`"]
-        pub fn for_alias_new_index<IAlias, INewIndex>(alias: IAlias, new_index: INewIndex, body: B) -> Self
+        pub fn for_alias_new_index<IAlias, INewIndex>(
+            alias: IAlias,
+            new_index: INewIndex,
+            body: B,
+        ) -> Self
         where
             IAlias: Into<Alias<'a>>,
             INewIndex: Into<NewIndex<'a>>,
@@ -3507,7 +3633,8 @@ pub mod endpoints {
                     UrlPath::from(url)
                 }
                 TermvectorsUrlParams::IndexTypeId(ref index, ref ty, ref id) => {
-                    let mut url = String::with_capacity(16usize + index.len() + ty.len() + id.len());
+                    let mut url =
+                        String::with_capacity(16usize + index.len() + ty.len() + id.len());
                     url.push_str("/");
                     url.push_str(index.as_ref());
                     url.push_str("/");
@@ -3539,7 +3666,12 @@ pub mod endpoints {
             }
         }
         #[doc = "Request to: `/{index}/{type}/{id}/_termvectors`"]
-        pub fn for_index_ty_id<IIndex, IType, IId>(index: IIndex, ty: IType, id: IId, body: B) -> Self
+        pub fn for_index_ty_id<IIndex, IType, IId>(
+            index: IIndex,
+            ty: IType,
+            id: IId,
+            body: B,
+        ) -> Self
         where
             IIndex: Into<Index<'a>>,
             IType: Into<Type<'a>>,
@@ -3603,7 +3735,8 @@ pub mod endpoints {
         pub fn url(self) -> UrlPath<'a> {
             match self {
                 CreateUrlParams::IndexTypeId(ref index, ref ty, ref id) => {
-                    let mut url = String::with_capacity(11usize + index.len() + ty.len() + id.len());
+                    let mut url =
+                        String::with_capacity(11usize + index.len() + ty.len() + id.len());
                     url.push_str("/");
                     url.push_str(index.as_ref());
                     url.push_str("/");
@@ -3624,7 +3757,12 @@ pub mod endpoints {
     }
     impl<'a, B> CreateRequest<'a, B> {
         #[doc = "Request to: `/{index}/{type}/{id}/_create`"]
-        pub fn for_index_ty_id<IIndex, IType, IId>(index: IIndex, ty: IType, id: IId, body: B) -> Self
+        pub fn for_index_ty_id<IIndex, IType, IId>(
+            index: IIndex,
+            ty: IType,
+            id: IId,
+            body: B,
+        ) -> Self
         where
             IIndex: Into<Index<'a>>,
             IType: Into<Type<'a>>,
@@ -3683,7 +3821,10 @@ pub mod endpoints {
     impl<'a, B> CountRequest<'a, B> {
         #[doc = "Request to: `/_count`"]
         pub fn new(body: B) -> Self {
-            CountRequest { url: CountUrlParams::None.url(), body: body }
+            CountRequest {
+                url: CountUrlParams::None.url(),
+                body: body,
+            }
         }
         #[doc = "Request to: `/{index}/_count`"]
         pub fn for_index<IIndex>(index: IIndex, body: B) -> Self
@@ -3742,7 +3883,9 @@ pub mod endpoints {
     impl<'a> CatRecoveryRequest<'a> {
         #[doc = "Request to: `/_cat/recovery`"]
         pub fn new() -> Self {
-            CatRecoveryRequest { url: CatRecoveryUrlParams::None.url() }
+            CatRecoveryRequest {
+                url: CatRecoveryUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_cat/recovery/{index}`"]
         pub fn for_index<IIndex>(index: IIndex) -> Self
@@ -3812,7 +3955,8 @@ pub mod endpoints {
         pub fn url(self) -> UrlPath<'a> {
             match self {
                 SnapshotDeleteUrlParams::RepositorySnapshot(ref repository, ref snapshot) => {
-                    let mut url = String::with_capacity(12usize + repository.len() + snapshot.len());
+                    let mut url =
+                        String::with_capacity(12usize + repository.len() + snapshot.len());
                     url.push_str("/_snapshot/");
                     url.push_str(repository.as_ref());
                     url.push_str("/");
@@ -3829,13 +3973,20 @@ pub mod endpoints {
     }
     impl<'a> SnapshotDeleteRequest<'a> {
         #[doc = "Request to: `/_snapshot/{repository}/{snapshot}`"]
-        pub fn for_repository_snapshot<IRepository, ISnapshot>(repository: IRepository, snapshot: ISnapshot) -> Self
+        pub fn for_repository_snapshot<IRepository, ISnapshot>(
+            repository: IRepository,
+            snapshot: ISnapshot,
+        ) -> Self
         where
             IRepository: Into<Repository<'a>>,
             ISnapshot: Into<Snapshot<'a>>,
         {
             SnapshotDeleteRequest {
-                url: SnapshotDeleteUrlParams::RepositorySnapshot(repository.into(), snapshot.into()).url(),
+                url: SnapshotDeleteUrlParams::RepositorySnapshot(
+                    repository.into(),
+                    snapshot.into(),
+                )
+                .url(),
             }
         }
     }
@@ -3891,7 +4042,9 @@ pub mod endpoints {
     impl<'a> NodesUsageRequest<'a> {
         #[doc = "Request to: `/_nodes/usage`"]
         pub fn new() -> Self {
-            NodesUsageRequest { url: NodesUsageUrlParams::None.url() }
+            NodesUsageRequest {
+                url: NodesUsageUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_nodes/usage/{metric}`"]
         pub fn for_metric<IMetric>(metric: IMetric) -> Self
@@ -4003,7 +4156,9 @@ pub mod endpoints {
     impl<'a> CatHelpRequest<'a> {
         #[doc = "Request to: `/_cat`"]
         pub fn new() -> Self {
-            CatHelpRequest { url: CatHelpUrlParams::None.url() }
+            CatHelpRequest {
+                url: CatHelpUrlParams::None.url(),
+            }
         }
     }
     impl<'a> Into<Endpoint<'a, DefaultBody>> for CatHelpRequest<'a> {
@@ -4122,7 +4277,9 @@ pub mod endpoints {
     impl<'a> CatIndicesRequest<'a> {
         #[doc = "Request to: `/_cat/indices`"]
         pub fn new() -> Self {
-            CatIndicesRequest { url: CatIndicesUrlParams::None.url() }
+            CatIndicesRequest {
+                url: CatIndicesUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_cat/indices/{index}`"]
         pub fn for_index<IIndex>(index: IIndex) -> Self
@@ -4151,7 +4308,8 @@ pub mod endpoints {
         pub fn url(self) -> UrlPath<'a> {
             match self {
                 GetSourceUrlParams::IndexTypeId(ref index, ref ty, ref id) => {
-                    let mut url = String::with_capacity(11usize + index.len() + ty.len() + id.len());
+                    let mut url =
+                        String::with_capacity(11usize + index.len() + ty.len() + id.len());
                     url.push_str("/");
                     url.push_str(index.as_ref());
                     url.push_str("/");
@@ -4312,7 +4470,9 @@ pub mod endpoints {
         where
             IId: Into<Id<'a>>,
         {
-            GetScriptRequest { url: GetScriptUrlParams::Id(id.into()).url() }
+            GetScriptRequest {
+                url: GetScriptUrlParams::Id(id.into()).url(),
+            }
         }
     }
     impl<'a> Into<Endpoint<'a, DefaultBody>> for GetScriptRequest<'a> {
@@ -4349,7 +4509,8 @@ pub mod endpoints {
                     UrlPath::from(url)
                 }
                 IndicesGetFieldMappingUrlParams::IndexTypeFields(ref index, ref ty, ref fields) => {
-                    let mut url = String::with_capacity(18usize + index.len() + ty.len() + fields.len());
+                    let mut url =
+                        String::with_capacity(18usize + index.len() + ty.len() + fields.len());
                     url.push_str("/");
                     url.push_str(index.as_ref());
                     url.push_str("/_mapping/");
@@ -4391,18 +4552,28 @@ pub mod endpoints {
             IFields: Into<Fields<'a>>,
         {
             IndicesGetFieldMappingRequest {
-                url: IndicesGetFieldMappingUrlParams::IndexFields(index.into(), fields.into()).url(),
+                url: IndicesGetFieldMappingUrlParams::IndexFields(index.into(), fields.into())
+                    .url(),
             }
         }
         #[doc = "Request to: `/{index}/_mapping/{type}/field/{fields}`"]
-        pub fn for_index_ty_fields<IIndex, IType, IFields>(index: IIndex, ty: IType, fields: IFields) -> Self
+        pub fn for_index_ty_fields<IIndex, IType, IFields>(
+            index: IIndex,
+            ty: IType,
+            fields: IFields,
+        ) -> Self
         where
             IIndex: Into<Index<'a>>,
             IType: Into<Type<'a>>,
             IFields: Into<Fields<'a>>,
         {
             IndicesGetFieldMappingRequest {
-                url: IndicesGetFieldMappingUrlParams::IndexTypeFields(index.into(), ty.into(), fields.into()).url(),
+                url: IndicesGetFieldMappingUrlParams::IndexTypeFields(
+                    index.into(),
+                    ty.into(),
+                    fields.into(),
+                )
+                .url(),
             }
         }
         #[doc = "Request to: `/_mapping/{type}/field/{fields}`"]
@@ -4468,7 +4639,9 @@ pub mod endpoints {
     impl<'a> IndicesStatsRequest<'a> {
         #[doc = "Request to: `/_stats`"]
         pub fn new() -> Self {
-            IndicesStatsRequest { url: IndicesStatsUrlParams::None.url() }
+            IndicesStatsRequest {
+                url: IndicesStatsUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/{index}/_stats`"]
         pub fn for_index<IIndex>(index: IIndex) -> Self
@@ -4534,7 +4707,9 @@ pub mod endpoints {
     impl<'a> CatShardsRequest<'a> {
         #[doc = "Request to: `/_cat/shards`"]
         pub fn new() -> Self {
-            CatShardsRequest { url: CatShardsUrlParams::None.url() }
+            CatShardsRequest {
+                url: CatShardsUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_cat/shards/{index}`"]
         pub fn for_index<IIndex>(index: IIndex) -> Self
@@ -4634,7 +4809,9 @@ pub mod endpoints {
     impl<'a> CatCountRequest<'a> {
         #[doc = "Request to: `/_cat/count`"]
         pub fn new() -> Self {
-            CatCountRequest { url: CatCountUrlParams::None.url() }
+            CatCountRequest {
+                url: CatCountUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_cat/count/{index}`"]
         pub fn for_index<IIndex>(index: IIndex) -> Self
@@ -4674,7 +4851,9 @@ pub mod endpoints {
     impl<'a> CatRepositoriesRequest<'a> {
         #[doc = "Request to: `/_cat/repositories`"]
         pub fn new() -> Self {
-            CatRepositoriesRequest { url: CatRepositoriesUrlParams::None.url() }
+            CatRepositoriesRequest {
+                url: CatRepositoriesUrlParams::None.url(),
+            }
         }
     }
     impl<'a> Into<Endpoint<'a, DefaultBody>> for CatRepositoriesRequest<'a> {
@@ -4705,7 +4884,9 @@ pub mod endpoints {
     impl<'a> InfoRequest<'a> {
         #[doc = "Request to: `/`"]
         pub fn new() -> Self {
-            InfoRequest { url: InfoUrlParams::None.url() }
+            InfoRequest {
+                url: InfoUrlParams::None.url(),
+            }
         }
     }
     impl<'a> Into<Endpoint<'a, DefaultBody>> for InfoRequest<'a> {
@@ -4780,7 +4961,9 @@ pub mod endpoints {
     impl<'a> ClusterGetSettingsRequest<'a> {
         #[doc = "Request to: `/_cluster/settings`"]
         pub fn new() -> Self {
-            ClusterGetSettingsRequest { url: ClusterGetSettingsUrlParams::None.url() }
+            ClusterGetSettingsRequest {
+                url: ClusterGetSettingsUrlParams::None.url(),
+            }
         }
     }
     impl<'a> Into<Endpoint<'a, DefaultBody>> for ClusterGetSettingsRequest<'a> {
@@ -4835,7 +5018,9 @@ pub mod endpoints {
     impl<'a> IndicesGetAliasRequest<'a> {
         #[doc = "Request to: `/_alias`"]
         pub fn new() -> Self {
-            IndicesGetAliasRequest { url: IndicesGetAliasUrlParams::None.url() }
+            IndicesGetAliasRequest {
+                url: IndicesGetAliasUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/{index}/_alias`"]
         pub fn for_index<IIndex>(index: IIndex) -> Self
@@ -4947,7 +5132,9 @@ pub mod endpoints {
     impl<'a> CatNodeattrsRequest<'a> {
         #[doc = "Request to: `/_cat/nodeattrs`"]
         pub fn new() -> Self {
-            CatNodeattrsRequest { url: CatNodeattrsUrlParams::None.url() }
+            CatNodeattrsRequest {
+                url: CatNodeattrsUrlParams::None.url(),
+            }
         }
     }
     impl<'a> Into<Endpoint<'a, DefaultBody>> for CatNodeattrsRequest<'a> {
@@ -5123,7 +5310,9 @@ pub mod endpoints {
     impl<'a> IndicesSegmentsRequest<'a> {
         #[doc = "Request to: `/_segments`"]
         pub fn new() -> Self {
-            IndicesSegmentsRequest { url: IndicesSegmentsUrlParams::None.url() }
+            IndicesSegmentsRequest {
+                url: IndicesSegmentsUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/{index}/_segments`"]
         pub fn for_index<IIndex>(index: IIndex) -> Self
@@ -5163,7 +5352,9 @@ pub mod endpoints {
     impl<'a> CatNodesRequest<'a> {
         #[doc = "Request to: `/_cat/nodes`"]
         pub fn new() -> Self {
-            CatNodesRequest { url: CatNodesUrlParams::None.url() }
+            CatNodesRequest {
+                url: CatNodesUrlParams::None.url(),
+            }
         }
     }
     impl<'a> Into<Endpoint<'a, DefaultBody>> for CatNodesRequest<'a> {
@@ -5244,7 +5435,9 @@ pub mod endpoints {
     impl<'a> CatAllocationRequest<'a> {
         #[doc = "Request to: `/_cat/allocation`"]
         pub fn new() -> Self {
-            CatAllocationRequest { url: CatAllocationUrlParams::None.url() }
+            CatAllocationRequest {
+                url: CatAllocationUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_cat/allocation/{node_id}`"]
         pub fn for_node_id<INodeId>(node_id: INodeId) -> Self
@@ -5292,7 +5485,9 @@ pub mod endpoints {
     impl<'a> IndicesGetUpgradeRequest<'a> {
         #[doc = "Request to: `/_upgrade`"]
         pub fn new() -> Self {
-            IndicesGetUpgradeRequest { url: IndicesGetUpgradeUrlParams::None.url() }
+            IndicesGetUpgradeRequest {
+                url: IndicesGetUpgradeUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/{index}/_upgrade`"]
         pub fn for_index<IIndex>(index: IIndex) -> Self
@@ -5373,7 +5568,9 @@ pub mod endpoints {
     impl<'a> PingRequest<'a> {
         #[doc = "Request to: `/`"]
         pub fn new() -> Self {
-            PingRequest { url: PingUrlParams::None.url() }
+            PingRequest {
+                url: PingUrlParams::None.url(),
+            }
         }
     }
     impl<'a> Into<Endpoint<'a, DefaultBody>> for PingRequest<'a> {
@@ -5404,7 +5601,9 @@ pub mod endpoints {
     impl<'a> PingHeadRequest<'a> {
         #[doc = "Request to: `/`"]
         pub fn new() -> Self {
-            PingHeadRequest { url: PingHeadUrlParams::None.url() }
+            PingHeadRequest {
+                url: PingHeadUrlParams::None.url(),
+            }
         }
     }
     impl<'a> Into<Endpoint<'a, DefaultBody>> for PingHeadRequest<'a> {
@@ -5424,7 +5623,8 @@ pub mod endpoints {
         pub fn url(self) -> UrlPath<'a> {
             match self {
                 UpdateUrlParams::IndexTypeId(ref index, ref ty, ref id) => {
-                    let mut url = String::with_capacity(11usize + index.len() + ty.len() + id.len());
+                    let mut url =
+                        String::with_capacity(11usize + index.len() + ty.len() + id.len());
                     url.push_str("/");
                     url.push_str(index.as_ref());
                     url.push_str("/");
@@ -5445,7 +5645,12 @@ pub mod endpoints {
     }
     impl<'a, B> UpdateRequest<'a, B> {
         #[doc = "Request to: `/{index}/{type}/{id}/_update`"]
-        pub fn for_index_ty_id<IIndex, IType, IId>(index: IIndex, ty: IType, id: IId, body: B) -> Self
+        pub fn for_index_ty_id<IIndex, IType, IId>(
+            index: IIndex,
+            ty: IType,
+            id: IId,
+            body: B,
+        ) -> Self
         where
             IIndex: Into<Index<'a>>,
             IType: Into<Type<'a>>,
@@ -5514,7 +5719,12 @@ pub mod endpoints {
             }
         }
         #[doc = "Request to: `/{index}/{type}/{id}`"]
-        pub fn for_index_ty_id<IIndex, IType, IId>(index: IIndex, ty: IType, id: IId, body: B) -> Self
+        pub fn for_index_ty_id<IIndex, IType, IId>(
+            index: IIndex,
+            ty: IType,
+            id: IId,
+            body: B,
+        ) -> Self
         where
             IIndex: Into<Index<'a>>,
             IType: Into<Type<'a>>,
@@ -5570,7 +5780,9 @@ pub mod endpoints {
     impl<'a> ClusterStateRequest<'a> {
         #[doc = "Request to: `/_cluster/state`"]
         pub fn new() -> Self {
-            ClusterStateRequest { url: ClusterStateUrlParams::None.url() }
+            ClusterStateRequest {
+                url: ClusterStateUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_cluster/state/{metric}`"]
         pub fn for_metric<IMetric>(metric: IMetric) -> Self
@@ -5686,7 +5898,10 @@ pub mod endpoints {
     impl<'a, B> MsearchRequest<'a, B> {
         #[doc = "Request to: `/_msearch`"]
         pub fn new(body: B) -> Self {
-            MsearchRequest { url: MsearchUrlParams::None.url(), body: body }
+            MsearchRequest {
+                url: MsearchUrlParams::None.url(),
+                body: body,
+            }
         }
         #[doc = "Request to: `/{index}/_msearch`"]
         pub fn for_index<IIndex>(index: IIndex, body: B) -> Self
@@ -5780,7 +5995,9 @@ pub mod endpoints {
     impl<'a> NodesReloadSecureSettingsUrlParams<'a> {
         pub fn url(self) -> UrlPath<'a> {
             match self {
-                NodesReloadSecureSettingsUrlParams::None => UrlPath::from("/_nodes/reload_secure_settings"),
+                NodesReloadSecureSettingsUrlParams::None => {
+                    UrlPath::from("/_nodes/reload_secure_settings")
+                }
                 NodesReloadSecureSettingsUrlParams::NodeId(ref node_id) => {
                     let mut url = String::with_capacity(31usize + node_id.len());
                     url.push_str("/_nodes/");
@@ -6015,7 +6232,9 @@ pub mod endpoints {
     impl<'a> CatPluginsRequest<'a> {
         #[doc = "Request to: `/_cat/plugins`"]
         pub fn new() -> Self {
-            CatPluginsRequest { url: CatPluginsUrlParams::None.url() }
+            CatPluginsRequest {
+                url: CatPluginsUrlParams::None.url(),
+            }
         }
     }
     impl<'a> Into<Endpoint<'a, DefaultBody>> for CatPluginsRequest<'a> {
@@ -6047,7 +6266,10 @@ pub mod endpoints {
     impl<'a, B> ReindexRequest<'a, B> {
         #[doc = "Request to: `/_reindex`"]
         pub fn new(body: B) -> Self {
-            ReindexRequest { url: ReindexUrlParams::None.url(), body: body }
+            ReindexRequest {
+                url: ReindexUrlParams::None.url(),
+                body: body,
+            }
         }
     }
     impl<'a, B> Into<Endpoint<'a, B>> for ReindexRequest<'a, B> {
@@ -6085,7 +6307,9 @@ pub mod endpoints {
     impl<'a> CatFielddataRequest<'a> {
         #[doc = "Request to: `/_cat/fielddata`"]
         pub fn new() -> Self {
-            CatFielddataRequest { url: CatFielddataUrlParams::None.url() }
+            CatFielddataRequest {
+                url: CatFielddataUrlParams::None.url(),
+            }
         }
         #[doc = "Request to: `/_cat/fielddata/{fields}`"]
         pub fn for_fields<IFields>(fields: IFields) -> Self
@@ -6125,7 +6349,9 @@ pub mod endpoints {
     impl<'a> CatTasksRequest<'a> {
         #[doc = "Request to: `/_cat/tasks`"]
         pub fn new() -> Self {
-            CatTasksRequest { url: CatTasksUrlParams::None.url() }
+            CatTasksRequest {
+                url: CatTasksUrlParams::None.url(),
+            }
         }
     }
     impl<'a> Into<Endpoint<'a, DefaultBody>> for CatTasksRequest<'a> {
@@ -6156,7 +6382,9 @@ pub mod endpoints {
     impl<'a> IngestProcessorGrokRequest<'a> {
         #[doc = "Request to: `/_ingest/processor/grok`"]
         pub fn new() -> Self {
-            IngestProcessorGrokRequest { url: IngestProcessorGrokUrlParams::None.url() }
+            IngestProcessorGrokRequest {
+                url: IngestProcessorGrokUrlParams::None.url(),
+            }
         }
     }
     impl<'a> Into<Endpoint<'a, DefaultBody>> for IngestProcessorGrokRequest<'a> {
@@ -6269,7 +6497,9 @@ pub mod endpoints {
     impl ClusterAllocationExplainUrlParams {
         pub fn url<'a>(self) -> UrlPath<'a> {
             match self {
-                ClusterAllocationExplainUrlParams::None => UrlPath::from("/_cluster/allocation/explain"),
+                ClusterAllocationExplainUrlParams::None => {
+                    UrlPath::from("/_cluster/allocation/explain")
+                }
             }
         }
     }
diff --git a/src/requests/src/lib.rs b/src/requests/src/lib.rs
index 2e0d46c3cf..8cc4828523 100644
--- a/src/requests/src/lib.rs
+++ b/src/requests/src/lib.rs
@@ -123,7 +123,12 @@ mod tests {
 
     fn do_something_with_request<'a, I: Into<Endpoint<'a, B>>, B: AsRef<[u8]>>(_: I) {}
 
-    fn do_something_with_static_request<I: Into<Endpoint<'static, B>>, B: 'static + AsRef<[u8]> + Send>(req: I) -> thread::JoinHandle<()> {
+    fn do_something_with_static_request<
+        I: Into<Endpoint<'static, B>>,
+        B: 'static + AsRef<[u8]> + Send,
+    >(
+        req: I,
+    ) -> thread::JoinHandle<()> {
         let req = req.into();
         thread::spawn(move || {
             assert_eq!("/test_index/test_ty/_search", *req.url);
@@ -132,7 +137,8 @@ mod tests {
 
     #[test]
     fn it_works() {
-        let req = SearchRequest::for_index_ty("test_index", "test_ty", "{'query': { 'match_all': {}}}");
+        let req =
+            SearchRequest::for_index_ty("test_index", "test_ty", "{'query': { 'match_all': {}}}");
 
         assert_eq!("/test_index/test_ty/_search", *req.url);
 
@@ -155,7 +161,14 @@ mod tests {
 
     #[test]
     fn id_from_number() {
-        let ids = vec![Id::from(1i32), Id::from(1u32), Id::from(1i64), Id::from(1u64), Id::from(1isize), Id::from(1usize)];
+        let ids = vec![
+            Id::from(1i32),
+            Id::from(1u32),
+            Id::from(1i64),
+            Id::from(1u64),
+            Id::from(1isize),
+            Id::from(1usize),
+        ];
 
         for id in ids {
             assert_eq!("1", &*id);
diff --git a/src/requests_codegen/src/gen/mod.rs b/src/requests_codegen/src/gen/mod.rs
index b5a85f9e61..c218ec7acf 100644
--- a/src/requests_codegen/src/gen/mod.rs
+++ b/src/requests_codegen/src/gen/mod.rs
@@ -1,17 +1,17 @@
-pub mod url_params;
-pub mod url_builder;
-pub mod request_params;
 pub mod request_ctors;
 pub mod request_into_endpoint;
+pub mod request_params;
+pub mod url_builder;
+pub mod url_params;
 
 pub mod types {
     /// Type and declarations for the `Body` type.
     ///
     /// This type is an alias for a borrowed slice of bytes.
     pub mod url {
-        use syn;
-        use quote;
         use gen::helpers;
+        use quote;
+        use syn;
 
         pub fn ident() -> &'static str {
             "UrlPath"
@@ -34,7 +34,7 @@ pub mod types {
                         #ident (Cow::Borrowed(value))
                     }
                 }
-                
+
                 impl <'a> From<String> for #url {
                     fn from(value: String) -> #url {
                         #ident (Cow::Owned(value))
@@ -56,9 +56,9 @@ pub mod types {
     ///
     /// This type is an alias for a borrowed slice of bytes.
     pub mod body {
-        use syn;
-        use quote;
         use gen::helpers;
+        use quote;
+        use syn;
 
         pub fn ident() -> &'static str {
             "B"
@@ -92,10 +92,13 @@ pub mod types {
     ///
     /// This type is a simple, standard wrapper for a HTTP request.
     pub mod request {
-        use super::{body, url};
+        use super::{
+            body,
+            url,
+        };
+        use gen::helpers;
         use quote;
         use syn;
-        use gen::helpers;
 
         pub fn method_ident() -> &'static str {
             "Method"
@@ -135,9 +138,9 @@ pub mod types {
 
     /// Macro for declaring a wrapped type declaration.
     pub mod wrapped_ty {
+        use gen::helpers;
         use inflector::Inflector;
         use quote;
-        use gen::helpers;
 
         pub fn item(ty: &str) -> quote::Tokens {
             let ty = ty.to_pascal_case();
@@ -168,7 +171,7 @@ pub mod types {
 
                 impl <'a> ::std::ops::Deref for #ty {
                     type Target = str;
-                    
+
                     fn deref(&self) -> &str {
                         &self.0
                     }
@@ -179,9 +182,9 @@ pub mod types {
 }
 
 pub mod helpers {
-    use syn;
-    use quote;
     use inflector::Inflector;
+    use quote;
+    use syn;
 
     fn sanitise_ident(ident: &str) -> &str {
         match ident {
@@ -289,11 +292,13 @@ pub mod helpers {
                 .into_iter()
                 .map(|(path, lifetimes, types)| syn::PathSegment {
                     ident: syn::Ident::new(sanitise_ident(path)),
-                    parameters: syn::PathParameters::AngleBracketed(syn::AngleBracketedParameterData {
-                        lifetimes: lifetimes,
-                        types: types,
-                        bindings: vec![],
-                    }),
+                    parameters: syn::PathParameters::AngleBracketed(
+                        syn::AngleBracketedParameterData {
+                            lifetimes: lifetimes,
+                            types: types,
+                            bindings: vec![],
+                        },
+                    ),
                 })
                 .collect(),
         }
@@ -305,7 +310,8 @@ pub mod helpers {
             ident(method),
             vec![],
             args.iter().map(|a| path_none(a).into_expr()).collect(),
-        ).into()
+        )
+        .into()
     }
 
     /// AST for a simple field access.
diff --git a/src/requests_codegen/src/gen/request_ctors.rs b/src/requests_codegen/src/gen/request_ctors.rs
index 93f896a9fc..d3d65fbb5e 100644
--- a/src/requests_codegen/src/gen/request_ctors.rs
+++ b/src/requests_codegen/src/gen/request_ctors.rs
@@ -1,7 +1,7 @@
-use syn;
-use parse::Endpoint;
 use super::helpers::*;
 use super::types;
+use parse::Endpoint;
+use syn;
 
 /// Structure for a request type constructor associated function.
 struct Constructor {
@@ -70,7 +70,12 @@ impl RequestParamsCtorBuilder {
     /// A constructor function with url parameters.
     ///
     /// This function has the form `param1_param2(param1, param2, body?)`.
-    fn ctor(name: &str, fields: Vec<String>, has_body: bool, doc_comment: Option<String>) -> Constructor {
+    fn ctor(
+        name: &str,
+        fields: Vec<String>,
+        has_body: bool,
+        doc_comment: Option<String>,
+    ) -> Constructor {
         let fields: Vec<(syn::Ident, syn::Ty)> = fields
             .iter()
             .map(|f| (ident(f.into_rust_var()), ty_a(f)))
@@ -143,7 +148,8 @@ impl RequestParamsCtorBuilder {
             match ctor.params_fields.len() {
                 0 => ident("None"),
                 _ => {
-                    let params_ty_variant: Vec<String> = ctor.params_fields
+                    let params_ty_variant: Vec<String> = ctor
+                        .params_fields
                         .iter()
                         .map(|&(_, ref t)| t.get_ident().into_rust_type())
                         .collect();
@@ -168,18 +174,17 @@ impl RequestParamsCtorBuilder {
                     .iter()
                     .map(|&(ref f, _)| Self::expr_into(f))
                     .collect(),
-            ).into(),
+            )
+            .into(),
         };
 
         // AST to set the url field: `url: UrlParams::SomeVariant(a, b).url()`
-        let mut fields = vec![
-            syn::FieldValue {
-                attrs: vec![],
-                ident: ident("url"),
-                expr: syn::ExprKind::MethodCall(ident("url"), vec![], vec![params_expr]).into(),
-                is_shorthand: false,
-            },
-        ];
+        let mut fields = vec![syn::FieldValue {
+            attrs: vec![],
+            ident: ident("url"),
+            expr: syn::ExprKind::MethodCall(ident("url"), vec![], vec![params_expr]).into(),
+            is_shorthand: false,
+        }];
 
         // AST to set the body field, if present: `body: Body::new(body)`
         if let &Some((ref body_ident, _)) = &ctor.body_field {
@@ -203,7 +208,8 @@ impl RequestParamsCtorBuilder {
     /// Build the function header for the constructor.
     fn ctor_decl(ctor: &Constructor) -> syn::FnDecl {
         // Generic field args: `index: IIndex`.
-        let mut args: Vec<syn::FnArg> = ctor.fields()
+        let mut args: Vec<syn::FnArg> = ctor
+            .fields()
             .iter()
             .map(|&f| {
                 let (ref name, ref field) = *f;
@@ -235,7 +241,8 @@ impl RequestParamsCtorBuilder {
 
     /// Build a self implementation for the request parameter constructors.
     fn ctor_item(req_ty: syn::Ty, params_ty: syn::Ty, ctor: &Constructor) -> syn::ImplItem {
-        let generic_fields: Vec<&syn::Ty> = ctor.fields()
+        let generic_fields: Vec<&syn::Ty> = ctor
+            .fields()
             .iter()
             .map(|&f| {
                 let (_, ref ty) = *f;
@@ -289,13 +296,15 @@ impl RequestParamsCtorBuilder {
     }
 
     pub fn build(self) -> syn::Item {
-        let ctors: Vec<syn::ImplItem> = self.ctors
+        let ctors: Vec<syn::ImplItem> = self
+            .ctors
             .iter()
             .map(|c| Self::ctor_item(self.req_ty.clone(), self.params_ty.clone(), c))
             .collect();
 
         let generics = {
-            let segment = self.req_ty
+            let segment = self
+                .req_ty
                 .get_path()
                 .to_owned()
                 .segments
@@ -305,7 +314,8 @@ impl RequestParamsCtorBuilder {
 
             match segment.parameters {
                 syn::PathParameters::AngleBracketed(data) => {
-                    let types = data.types
+                    let types = data
+                        .types
                         .iter()
                         .map(|t| ty_param(t.get_ident().as_ref(), vec![]))
                         .collect();
@@ -332,21 +342,19 @@ impl RequestParamsCtorBuilder {
     }
 }
 
-impl<
-    'a,
-> From<
-    (
+impl<'a>
+    From<(
         &'a (String, Endpoint),
         &'a syn::Ty,
         &'a (syn::Item, syn::Ty),
-    ),
-> for RequestParamsCtorBuilder {
+    )> for RequestParamsCtorBuilder
+{
     fn from(
         value: (
             &'a (String, Endpoint),
             &'a syn::Ty,
             &'a (syn::Item, syn::Ty),
-        )
+        ),
     ) -> Self {
         let (&(_, ref endpoint), ref req_ty, &(ref params, ref params_ty)) = value;
 
@@ -394,22 +402,20 @@ impl<
 
 #[cfg(test)]
 pub mod tests {
+    #![cfg_attr(rustfmt, rustfmt_skip)]
+    
     use super::*;
 
     #[test]
     fn gen_request_ctor_none() {
         let req_ty = ty_a("Request");
-        let result = RequestParamsCtorBuilder::new(false, req_ty, ty_a("UrlParams"))
-            .with_constructor(vec![], Some("A doc comment".to_owned()))
-            .build();
+        let result = RequestParamsCtorBuilder::new(false, req_ty, ty_a("UrlParams")).with_constructor(vec![], Some("A doc comment".to_owned())).build();
 
         let expected = quote!(
-            impl <'a> Request<'a> {
+            impl<'a> Request<'a> {
                 #[doc = "A doc comment"]
                 pub fn new() -> Self {
-                    Request {
-                        url: UrlParams::None.url()
-                    }
+                    Request { url: UrlParams::None.url() }
                 }
             }
         );
@@ -421,19 +427,17 @@ pub mod tests {
     fn gen_request_ctor_params() {
         let req_ty = ty_a("Request");
         let result = RequestParamsCtorBuilder::new(false, req_ty, ty_a("UrlParams"))
-            .with_constructor(
-                vec!["Index".into(), "Type".into(), "Id".into()],
-                Some("A doc comment".to_owned()),
-            )
+            .with_constructor(vec!["Index".into(), "Type".into(), "Id".into()], Some("A doc comment".to_owned()))
             .build();
 
         let expected = quote!(
-            impl <'a> Request<'a> {
+            impl<'a> Request<'a> {
                 #[doc = "A doc comment"]
                 pub fn for_index_ty_id<IIndex, IType, IId>(index: IIndex, ty: IType, id: IId) -> Self
-                    where IIndex: Into<Index<'a> >,
-                          IType: Into<Type<'a> >,
-                          IId: Into<Id<'a> >
+                where
+                    IIndex: Into<Index<'a> >,
+                    IType: Into<Type<'a> >,
+                    IId: Into<Id<'a> >
                 {
                     Request {
                         url: UrlParams::IndexTypeId(index.into(), ty.into(), id.into()).url()
@@ -448,17 +452,12 @@ pub mod tests {
     #[test]
     fn gen_request_ctor_body() {
         let req_ty = ty_path("Request", vec![lifetime()], vec![types::body::ty()]);
-        let result = RequestParamsCtorBuilder::new(true, req_ty, ty_a("UrlParams"))
-            .with_constructor(vec![], None)
-            .build();
+        let result = RequestParamsCtorBuilder::new(true, req_ty, ty_a("UrlParams")).with_constructor(vec![], None).build();
 
         let expected = quote!(
-            impl <'a, B> Request<'a, B> {
+            impl<'a, B> Request<'a, B> {
                 pub fn new(body: B) -> Self {
-                    Request {
-                        url: UrlParams::None.url(),
-                        body: body
-                    }
+                    Request { url: UrlParams::None.url(), body: body }
                 }
             }
         );
@@ -469,16 +468,15 @@ pub mod tests {
     #[test]
     fn gen_request_ctor_params_body() {
         let req_ty = ty_path("Request", vec![lifetime()], vec![types::body::ty()]);
-        let result = RequestParamsCtorBuilder::new(true, req_ty, ty_a("UrlParams"))
-            .with_constructor(vec!["Index".into(), "Type".into(), "Id".into()], None)
-            .build();
+        let result = RequestParamsCtorBuilder::new(true, req_ty, ty_a("UrlParams")).with_constructor(vec!["Index".into(), "Type".into(), "Id".into()], None).build();
 
         let expected = quote!(
-            impl <'a, B> Request<'a, B> {
-                pub fn for_index_ty_id<IIndex, IType, IId>(index: IIndex, ty: IType, id: IId, body: B) -> Self 
-                    where IIndex: Into<Index<'a> >,
-                          IType: Into<Type<'a> >,
-                          IId: Into<Id<'a> >
+            impl<'a, B> Request<'a, B> {
+                pub fn for_index_ty_id<IIndex, IType, IId>(index: IIndex, ty: IType, id: IId, body: B) -> Self
+                where
+                    IIndex: Into<Index<'a> >,
+                    IType: Into<Type<'a> >,
+                    IId: Into<Id<'a> >
                 {
                     Request {
                         url: UrlParams::IndexTypeId(index.into(), ty.into(), id.into()).url(),
@@ -493,8 +491,8 @@ pub mod tests {
 
     #[test]
     fn gen_request_ctor_from_endpoint() {
-        use parse::*;
         use gen::url_params::UrlParamBuilder;
+        use parse::*;
 
         let endpoint = (
             "indices.exists_alias".to_string(),
@@ -502,48 +500,44 @@ pub mod tests {
                 documentation: String::new(),
                 methods: vec![Method::Get],
                 url: get_url(),
-                body: Some(Body {
-                    description: String::new(),
-                }),
+                body: Some(Body { description: String::new() }),
             },
         );
 
-        let req_ty = ty_path(
-            "IndicesExistsAliasRequest",
-            vec![lifetime()],
-            vec![types::body::ty()],
-        );
+        let req_ty = ty_path("IndicesExistsAliasRequest", vec![lifetime()], vec![types::body::ty()]);
         let url_params = UrlParamBuilder::from(&endpoint).build();
 
         let result = RequestParamsCtorBuilder::from((&endpoint, &req_ty, &url_params)).build();
 
         let expected = quote!(
-            impl <'a, B> IndicesExistsAliasRequest <'a, B> {
+            impl<'a, B> IndicesExistsAliasRequest<'a, B> {
                 #[doc = "Request to: `/_search`"]
-                pub fn new(body: B) -> Self { 
-                    IndicesExistsAliasRequest { 
-                        url : IndicesExistsAliasUrlParams::None.url(),
+                pub fn new(body: B) -> Self {
+                    IndicesExistsAliasRequest {
+                        url: IndicesExistsAliasUrlParams::None.url(),
                         body: body
                     }
                 }
 
                 #[doc = "Request to: `/{index}/_search`"]
                 pub fn for_index<IIndex>(index: IIndex, body: B) -> Self
-                    where IIndex: Into<Index<'a> >
-                { 
-                    IndicesExistsAliasRequest { 
-                        url : IndicesExistsAliasUrlParams::Index(index.into()).url(),
+                where
+                    IIndex: Into<Index<'a> >
+                {
+                    IndicesExistsAliasRequest {
+                        url: IndicesExistsAliasUrlParams::Index(index.into()).url(),
                         body: body
                     }
                 }
 
                 #[doc = "Request to: `/{index}/{type}/_search`"]
                 pub fn for_index_ty<IIndex, IType>(index: IIndex, ty: IType, body: B) -> Self
-                    where IIndex: Into<Index<'a> >,
-                          IType: Into<Type<'a> >
-                { 
-                    IndicesExistsAliasRequest { 
-                        url : IndicesExistsAliasUrlParams::IndexType(index.into(), ty.into()).url(),
+                where
+                    IIndex: Into<Index<'a> >,
+                    IType: Into<Type<'a> >
+                {
+                    IndicesExistsAliasRequest {
+                        url: IndicesExistsAliasUrlParams::IndexType(index.into(), ty.into()).url(),
                         body: body
                     }
                 }
diff --git a/src/requests_codegen/src/gen/request_into_endpoint.rs b/src/requests_codegen/src/gen/request_into_endpoint.rs
index de5d18a7a4..e00c491f70 100644
--- a/src/requests_codegen/src/gen/request_into_endpoint.rs
+++ b/src/requests_codegen/src/gen/request_into_endpoint.rs
@@ -1,8 +1,11 @@
-use syn;
-use quote;
-use parse::{Endpoint, Method};
-use super::types;
 use super::helpers::*;
+use super::types;
+use parse::{
+    Endpoint,
+    Method,
+};
+use quote;
+use syn;
 
 pub struct RequestIntoEndpointBuilder {
     req_ty: syn::Ty,
@@ -78,8 +81,10 @@ impl<'a> From<(&'a (String, Endpoint), &'a syn::Ty)> for RequestIntoEndpointBuil
 
 #[cfg(test)]
 mod tests {
-    use parse::*;
+    #![cfg_attr(rustfmt, rustfmt_skip)]
+    
     use super::*;
+    use parse::*;
 
     #[test]
     fn gen_into_http_req_with_body() {
@@ -89,9 +94,7 @@ mod tests {
                 documentation: String::new(),
                 methods: vec![Method::Get],
                 url: get_url(),
-                body: Some(Body {
-                    description: String::new(),
-                }),
+                body: Some(Body { description: String::new() }),
             },
         );
         let req_ty = ty_path("Request", vec![lifetime()], vec![types::body::ty()]);
@@ -99,7 +102,7 @@ mod tests {
         let result = RequestIntoEndpointBuilder::from((&endpoint, &req_ty)).build();
 
         let expected = quote!(
-            impl <'a, B> Into<Endpoint<'a, B> > for Request<'a, B> {
+            impl<'a, B> Into<Endpoint<'a, B> > for Request<'a, B> {
                 fn into(self) -> Endpoint<'a, B> {
                     Endpoint {
                         url: self.url,
@@ -129,7 +132,7 @@ mod tests {
         let result = RequestIntoEndpointBuilder::from((&endpoint, &req_ty)).build();
 
         let expected = quote!(
-            impl <'a> Into<Endpoint<'a, DefaultBody> > for Request<'a> {
+            impl<'a> Into<Endpoint<'a, DefaultBody> > for Request<'a> {
                 fn into(self) -> Endpoint<'a, DefaultBody> {
                     Endpoint {
                         url: self.url,
diff --git a/src/requests_codegen/src/gen/request_params.rs b/src/requests_codegen/src/gen/request_params.rs
index b0494a63e9..cd48e6089b 100644
--- a/src/requests_codegen/src/gen/request_params.rs
+++ b/src/requests_codegen/src/gen/request_params.rs
@@ -1,7 +1,7 @@
-use syn;
-use parse;
-use super::types;
 use super::helpers::*;
+use super::types;
+use parse;
+use syn;
 
 /// Builder for request parameters enum.
 pub struct RequestParamBuilder {
@@ -35,14 +35,12 @@ impl RequestParamBuilder {
     }
 
     pub fn build(self) -> (syn::Item, syn::Ty) {
-        let mut fields = vec![
-            syn::Field {
-                ident: Some(ident("url")),
-                vis: syn::Visibility::Public,
-                attrs: vec![],
-                ty: types::url::ty(),
-            },
-        ];
+        let mut fields = vec![syn::Field {
+            ident: Some(ident("url")),
+            vis: syn::Visibility::Public,
+            attrs: vec![],
+            ty: types::url::ty(),
+        }];
 
         let mut generics = generics(vec![lifetime()], vec![]);
 
@@ -116,6 +114,8 @@ impl<'a> From<&'a (String, parse::Endpoint)> for RequestParamBuilder {
 
 #[cfg(test)]
 mod tests {
+    #![cfg_attr(rustfmt, rustfmt_skip)]
+    
     use super::*;
 
     #[test]
@@ -151,10 +151,7 @@ mod tests {
 
     #[test]
     fn gen_request_params_with_body_doc() {
-        let (result, _) = RequestParamBuilder::new("Request")
-            .has_body(true)
-            .doc_comment("Some doc")
-            .build();
+        let (result, _) = RequestParamBuilder::new("Request").has_body(true).doc_comment("Some doc").build();
 
         let expected = quote!(
             #[doc = "Some doc"]
@@ -177,9 +174,7 @@ mod tests {
                 documentation: String::new(),
                 methods: vec![Method::Get],
                 url: get_url(),
-                body: Some(Body {
-                    description: String::new(),
-                }),
+                body: Some(Body { description: String::new() }),
             },
         );
 
diff --git a/src/requests_codegen/src/gen/url_builder.rs b/src/requests_codegen/src/gen/url_builder.rs
index 3703ec1c2f..28773bacc3 100644
--- a/src/requests_codegen/src/gen/url_builder.rs
+++ b/src/requests_codegen/src/gen/url_builder.rs
@@ -1,7 +1,10 @@
-use syn;
-use parse::{Endpoint, PathPart};
-use super::types;
 use super::helpers::*;
+use super::types;
+use parse::{
+    Endpoint,
+    PathPart,
+};
+use syn;
 
 /// Builder for match statements over a request parameters enum.
 pub struct UrlParamMatchBuilder {
@@ -91,9 +94,11 @@ impl<'a> From<(&'a (syn::Item, syn::Ty), Vec<syn::Block>)> for UrlParamMatchBuil
         let mut builder = UrlParamMatchBuilder::new(params_ty.to_owned());
 
         match params_item.node {
-            syn::ItemKind::Enum(ref variants, _) => for (variant, body) in variants.iter().zip(bodies.iter()) {
-                builder = builder.with_variant(variant, body);
-            },
+            syn::ItemKind::Enum(ref variants, _) => {
+                for (variant, body) in variants.iter().zip(bodies.iter()) {
+                    builder = builder.with_variant(variant, body);
+                }
+            }
             _ => panic!("expected syn::ItemKind::Enum"),
         };
 
@@ -144,7 +149,8 @@ impl<'a> UrlReplaceBuilder<'a> {
 
     /// Build a non-allocated url from the path literals.
     fn build_borrowed(self) -> syn::Block {
-        let path: Vec<&'a str> = self.url
+        let path: Vec<&'a str> = self
+            .url
             .iter()
             .map(|p| match *p {
                 PathPart::Literal(p) => p,
@@ -166,14 +172,13 @@ impl<'a> UrlReplaceBuilder<'a> {
 
     /// Get the number of chars in all literal parts for the url.
     fn literal_length_expr(url: &[PathPart<'a>]) -> syn::Expr {
-        let len = url.iter()
+        let len = url
+            .iter()
             .filter_map(|p| match *p {
                 PathPart::Literal(p) => Some(p),
                 _ => None,
             })
-            .fold(0, |acc, p| {
-                acc + p.len()
-            });
+            .fold(0, |acc, p| acc + p.len());
 
         syn::ExprKind::Lit(syn::Lit::Int(len as u64, syn::IntTy::Usize)).into()
     }
@@ -187,7 +192,8 @@ impl<'a> UrlReplaceBuilder<'a> {
                         ident("len"),
                         vec![],
                         vec![syn::ExprKind::Path(None, path_none(p)).into()],
-                    ).into(),
+                    )
+                    .into(),
                 ),
                 _ => None,
             })
@@ -220,10 +226,12 @@ impl<'a> UrlReplaceBuilder<'a> {
                         .segments
                         .push(syn::PathSegment::from("with_capacity"));
                     method
-                }).into(),
+                })
+                .into(),
             ),
             vec![len_expr],
-        ).into();
+        )
+        .into();
 
         syn::Stmt::Local(Box::new(syn::Local {
             pat: Box::new(syn::Pat::Ident(
@@ -362,24 +370,18 @@ impl<'a> From<(&'a (String, Endpoint), &'a (syn::Item, syn::Ty))> for UrlMethodB
 
 #[cfg(test)]
 mod tests {
-    use syn;
+    #![cfg_attr(rustfmt, rustfmt_skip)]
+    
     use super::*;
-    use parse::PathPart;
     use gen::url_params::*;
+    use parse::PathPart;
+    use syn;
 
     #[test]
     fn gen_url_match() {
-        let params = UrlParamBuilder::new("RequestParams")
-            .with_param_set(vec![])
-            .with_param_set(vec!["Index"])
-            .with_param_set(vec!["Index", "Type", "Id"])
-            .build();
-
-        let bodies = vec![
-            syn::Block { stmts: vec![] },
-            syn::Block { stmts: vec![] },
-            syn::Block { stmts: vec![] },
-        ];
+        let params = UrlParamBuilder::new("RequestParams").with_param_set(vec![]).with_param_set(vec!["Index"]).with_param_set(vec!["Index", "Type", "Id"]).build();
+
+        let bodies = vec![syn::Block { stmts: vec![] }, syn::Block { stmts: vec![] }, syn::Block { stmts: vec![] }];
 
         let result = UrlParamMatchBuilder::from((&params, bodies)).build();
 
@@ -403,12 +405,7 @@ mod tests {
 
     #[test]
     fn gen_url_with_params() {
-        let result = UrlReplaceBuilder::from(vec![
-            PathPart::Literal("/"),
-            PathPart::Param("index"),
-            PathPart::Literal("/_search/"),
-            PathPart::Param("type"),
-        ]).build();
+        let result = UrlReplaceBuilder::from(vec![PathPart::Literal("/"), PathPart::Param("index"), PathPart::Literal("/_search/"), PathPart::Param("type")]).build();
 
         let expected = quote!({
             let mut url = String::with_capacity(10usize + index.len() + ty.len());
@@ -431,7 +428,7 @@ mod tests {
 
         let expected = quote!(
             impl UrlParams {
-                pub fn url<'a>(self) -> UrlPath<'a> { 
+                pub fn url<'a>(self) -> UrlPath<'a> {
                     { }
                 }
             }
@@ -442,8 +439,8 @@ mod tests {
 
     #[test]
     fn gen_url_with_params_from_endpoint() {
-        use parse::*;
         use gen::url_params::*;
+        use parse::*;
 
         let endpoint = (
             "indices.exists_alias".to_string(),
@@ -451,9 +448,7 @@ mod tests {
                 documentation: String::new(),
                 methods: vec![Method::Get],
                 url: get_url(),
-                body: Some(Body {
-                    description: String::new(),
-                }),
+                body: Some(Body { description: String::new() }),
             },
         );
         let params = UrlParamBuilder::from(&endpoint).build();
@@ -471,7 +466,7 @@ mod tests {
                 url.push_str("/");
                 url.push_str(index.as_ref());
                 url.push_str("/_search");
-    
+
                 UrlPath::from(url)
             }
         );
@@ -483,7 +478,7 @@ mod tests {
                 url.push_str("/");
                 url.push_str(ty.as_ref());
                 url.push_str("/_search");
-    
+
                 UrlPath::from(url)
             }
         );
diff --git a/src/requests_codegen/src/gen/url_params.rs b/src/requests_codegen/src/gen/url_params.rs
index fd3d966097..08d627ceee 100644
--- a/src/requests_codegen/src/gen/url_params.rs
+++ b/src/requests_codegen/src/gen/url_params.rs
@@ -1,7 +1,7 @@
+use super::helpers::*;
 use inflector::Inflector;
-use syn;
 use parse;
-use super::helpers::*;
+use syn;
 
 /// Builder for request url parameters enum.
 ///
@@ -122,6 +122,8 @@ impl<'a> From<&'a (String, parse::Endpoint)> for UrlParamBuilder {
 
 #[cfg(test)]
 mod tests {
+    #![cfg_attr(rustfmt, rustfmt_skip)]
+    
     use super::*;
 
     #[test]
@@ -129,8 +131,8 @@ mod tests {
         let (result, _) = UrlParamBuilder::new("RequestParams").build();
 
         let expected = quote!(
-            enum RequestParams { 
-                None, 
+            enum RequestParams {
+                None,
             }
         );
 
@@ -139,17 +141,13 @@ mod tests {
 
     #[test]
     fn gen_params_enum_with_param_sets() {
-        let (result, _) = UrlParamBuilder::new("RequestParams")
-            .with_param_set(vec![])
-            .with_param_set(vec!["Index"])
-            .with_param_set(vec!["Index", "Type", "Id"])
-            .build();
+        let (result, _) = UrlParamBuilder::new("RequestParams").with_param_set(vec![]).with_param_set(vec!["Index"]).with_param_set(vec!["Index", "Type", "Id"]).build();
 
         let expected = quote!(
-            enum RequestParams<'a> { 
-                None, 
-                Index(Index<'a>), 
-                IndexTypeId(Index<'a>, Type<'a>, Id<'a>), 
+            enum RequestParams<'a> {
+                None,
+                Index(Index<'a>),
+                IndexTypeId(Index<'a>, Type<'a>, Id<'a>),
             }
         );
 
@@ -173,10 +171,10 @@ mod tests {
         let (result, _) = UrlParamBuilder::from(&endpoint).build();
 
         let expected = quote!(
-            enum IndicesExistsAliasUrlParams<'a> { 
+            enum IndicesExistsAliasUrlParams<'a> {
                 None,
-                Index(Index<'a>), 
-                IndexType(Index<'a>, Type<'a>), 
+                Index(Index<'a>),
+                IndexType(Index<'a>, Type<'a>),
             }
         );
 
diff --git a/src/requests_codegen/src/main.rs b/src/requests_codegen/src/main.rs
index e78194df22..7becf2d71c 100644
--- a/src/requests_codegen/src/main.rs
+++ b/src/requests_codegen/src/main.rs
@@ -15,15 +15,22 @@ extern crate syn;
 
 extern crate inflector;
 
-pub mod parse;
 pub mod gen;
+pub mod parse;
 
 use std::collections::BTreeMap;
-use std::io::{stdout, Read, Write};
-use std::fs::{read_dir, File};
+use std::fs::{
+    read_dir,
+    File,
+};
+use std::io::{
+    stdout,
+    Read,
+    Write,
+};
 
-use quote::Tokens;
 use parse::*;
+use quote::Tokens;
 
 fn main() {
     start_comment_block_for_logging();
@@ -109,7 +116,8 @@ fn from_reader<R>(name: String, rdr: &mut R) -> Result<(String, Endpoint), Strin
 where
     R: Read,
 {
-    let endpoint: BTreeMap<String, Endpoint> = try!(serde_json::from_reader(rdr).map_err(|e| format!("Failed to parse {} because: {}", name, e)));
+    let endpoint: BTreeMap<String, Endpoint> = try!(serde_json::from_reader(rdr)
+        .map_err(|e| format!("Failed to parse {} because: {}", name, e)));
 
     Ok(endpoint.endpoint())
 }
@@ -186,7 +194,13 @@ impl CustomEndpoints for Vec<(String, Endpoint)> {
     }
 }
 
-fn endpoints_mod(tokens: &mut Tokens, derives: Tokens, http_mod: &'static str, endpoints: Vec<(String, Endpoint)>, params_to_emit: &mut BTreeMap<String, bool>) {
+fn endpoints_mod(
+    tokens: &mut Tokens,
+    derives: Tokens,
+    http_mod: &'static str,
+    endpoints: Vec<(String, Endpoint)>,
+    params_to_emit: &mut BTreeMap<String, bool>,
+) {
     let mut http_mod_tokens = Tokens::new();
     http_mod_tokens.append(http_mod);
 
@@ -206,12 +220,17 @@ fn endpoints_mod(tokens: &mut Tokens, derives: Tokens, http_mod: &'static str, e
         let url_params = gen::url_params::UrlParamBuilder::from(&e).build();
         let (ref url_params_item, _) = url_params;
 
-        let (req_params_item, req_params_ty) = gen::request_params::RequestParamBuilder::from(&e).build();
+        let (req_params_item, req_params_ty) =
+            gen::request_params::RequestParamBuilder::from(&e).build();
 
-        let req_ctors_item = gen::request_ctors::RequestParamsCtorBuilder::from((&e, &req_params_ty, &url_params)).build();
+        let req_ctors_item =
+            gen::request_ctors::RequestParamsCtorBuilder::from((&e, &req_params_ty, &url_params))
+                .build();
         let url_method_item = gen::url_builder::UrlMethodBuilder::from((&e, &url_params)).build();
 
-        let req_into_http_item = gen::request_into_endpoint::RequestIntoEndpointBuilder::from((&e, &req_params_ty)).build();
+        let req_into_http_item =
+            gen::request_into_endpoint::RequestIntoEndpointBuilder::from((&e, &req_params_ty))
+                .build();
 
         tokens.append_all(vec![
             derives.clone(),
diff --git a/src/requests_codegen/src/parse/mod.rs b/src/requests_codegen/src/parse/mod.rs
index 63c2355d9d..1993e869f6 100644
--- a/src/requests_codegen/src/parse/mod.rs
+++ b/src/requests_codegen/src/parse/mod.rs
@@ -1,6 +1,6 @@
+use serde_json::Value;
 use std::collections::BTreeMap;
 use std::fmt;
-use serde_json::Value;
 
 mod parse;
 
@@ -25,7 +25,8 @@ pub struct Endpoint {
 impl Endpoint {
     pub fn has_body(&self) -> bool {
         self.body.is_some()
-            || self.methods
+            || self
+                .methods
                 .iter()
                 .any(|m| m == &Method::Post || m == &Method::Put)
     }
@@ -35,31 +36,41 @@ impl Endpoint {
         match iter.len() {
             0 => None,
             1 => iter.next(),
-            _ => if iter.any(|m| m == Method::Post) {
-                Some(Method::Post)
-            } else {
-                iter.next()
-            },
+            _ => {
+                if iter.any(|m| m == Method::Post) {
+                    Some(Method::Post)
+                } else {
+                    iter.next()
+                }
+            }
         }
     }
 }
 
 #[derive(Debug, PartialEq, Deserialize, Clone, Copy)]
 pub enum Method {
-    #[serde(rename = "HEAD")] Head,
-    #[serde(rename = "GET")] Get,
-    #[serde(rename = "POST")] Post,
-    #[serde(rename = "PUT")] Put,
-    #[serde(rename = "PATCH")] Patch,
-    #[serde(rename = "DELETE")] Delete,
+    #[serde(rename = "HEAD")]
+    Head,
+    #[serde(rename = "GET")]
+    Get,
+    #[serde(rename = "POST")]
+    Post,
+    #[serde(rename = "PUT")]
+    Put,
+    #[serde(rename = "PATCH")]
+    Patch,
+    #[serde(rename = "DELETE")]
+    Delete,
 }
 
 #[derive(Debug, PartialEq, Deserialize, Clone)]
 pub struct Url {
     pub path: Path,
     pub paths: Vec<Path>,
-    #[serde(default = "BTreeMap::new")] pub parts: BTreeMap<String, Type>,
-    #[serde(default = "BTreeMap::new")] pub params: BTreeMap<String, Type>,
+    #[serde(default = "BTreeMap::new")]
+    pub parts: BTreeMap<String, Type>,
+    #[serde(default = "BTreeMap::new")]
+    pub params: BTreeMap<String, Type>,
 }
 
 impl Url {
@@ -70,25 +81,38 @@ impl Url {
 
 #[derive(Debug, PartialEq, Deserialize, Clone)]
 pub struct Type {
-    #[serde(rename = "type", default)] pub ty: TypeKind,
+    #[serde(rename = "type", default)]
+    pub ty: TypeKind,
     pub description: String,
-    #[serde(default = "Vec::new")] pub options: Vec<Value>,
-    #[serde(default)] pub default: Option<Value>,
+    #[serde(default = "Vec::new")]
+    pub options: Vec<Value>,
+    #[serde(default)]
+    pub default: Option<Value>,
 }
 
 #[derive(Debug, PartialEq, Deserialize, Clone)]
 pub enum TypeKind {
     None,
-    #[serde(rename = "list")] List,
-    #[serde(rename = "enum")] Enum,
-    #[serde(rename = "string")] String,
-    #[serde(rename = "text")] Text,
-    #[serde(rename = "boolean")] Boolean,
-    #[serde(rename = "number")] Number,
-    #[serde(rename = "float")] Float,
-    #[serde(rename = "integer")] Integer,
-    #[serde(rename = "time")] Time,
-    #[serde(rename = "duration")] Duration,
+    #[serde(rename = "list")]
+    List,
+    #[serde(rename = "enum")]
+    Enum,
+    #[serde(rename = "string")]
+    String,
+    #[serde(rename = "text")]
+    Text,
+    #[serde(rename = "boolean")]
+    Boolean,
+    #[serde(rename = "number")]
+    Number,
+    #[serde(rename = "float")]
+    Float,
+    #[serde(rename = "integer")]
+    Integer,
+    #[serde(rename = "time")]
+    Time,
+    #[serde(rename = "duration")]
+    Duration,
 }
 
 impl Default for TypeKind {
@@ -255,7 +279,10 @@ pub fn get_url() -> Url {
 #[cfg(test)]
 mod tests {
     mod path {
-        use parse::{Path, PathPart};
+        use parse::{
+            Path,
+            PathPart,
+        };
 
         #[test]
         fn parse_param_only() {
@@ -403,10 +430,10 @@ mod tests {
     }
 
     mod ser {
-        use std::collections::BTreeMap;
+        use parse::*;
         use serde_json;
         use serde_json::value::to_value;
-        use parse::*;
+        use std::collections::BTreeMap;
 
         fn http_eq(expected: Method, ser: &'static str) {
             assert_eq!(expected, serde_json::from_str::<Method>(ser).unwrap());
@@ -539,7 +566,8 @@ mod tests {
                         "index".to_string(),
                         Type {
                             ty: TypeKind::List,
-                            description: "A comma-separated list of index names to search".to_string(),
+                            description: "A comma-separated list of index names to search"
+                                .to_string(),
                             options: vec![],
                             default: None,
                         },
@@ -549,7 +577,8 @@ mod tests {
                         "type".to_string(),
                         Type {
                             ty: TypeKind::List,
-                            description: "A comma-separated list of document types to search".to_string(),
+                            description: "A comma-separated list of document types to search"
+                                .to_string(),
                             options: vec![],
                             default: None,
                         },
diff --git a/src/responses/README.md b/src/responses/README.md
index 9e590706fb..095a561758 100644
--- a/src/responses/README.md
+++ b/src/responses/README.md
@@ -7,7 +7,6 @@ A crate to handle parsing and handling Elasticsearch search results which provid
 `Cargo.toml`
 ```
 [dependencies]
-elastic_reqwest = "*"
 elastic_responses = "*" 
 ```
 
diff --git a/src/responses/src/bulk.rs b/src/responses/src/bulk.rs
index 94c29630b1..a2019dfbca 100644
--- a/src/responses/src/bulk.rs
+++ b/src/responses/src/bulk.rs
@@ -2,18 +2,29 @@
 Response types for a [bulk request](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html).
 */
 
-use serde::de::{Deserialize, Deserializer, Error as DeError, MapAccess, SeqAccess, Visitor};
+use common::{
+    DefaultAllocatedField,
+    DocumentResult,
+    Shards,
+};
+use serde::de::{
+    Deserialize,
+    Deserializer,
+    Error as DeError,
+    MapAccess,
+    SeqAccess,
+    Visitor,
+};
 use serde_json::Value;
-use common::{DocumentResult, DefaultAllocatedField, Shards};
 
 use parsing::IsOkOnSuccess;
 
 use std::cmp;
+use std::error::Error;
 use std::fmt;
+use std::marker::PhantomData;
 use std::slice::Iter;
 use std::vec::IntoIter;
-use std::marker::PhantomData;
-use std::error::Error;
 
 type BulkError = Value;
 
@@ -128,7 +139,7 @@ Otherwise the function will only accept a default `BulkResponse`:
 ```
 # use elastic_responses::*;
 // Do: Supports any BulkResponse
-fn takes_any_response<TIndex, TType, TId>(res: BulkResponse<TIndex, TType, TId>) { 
+fn takes_any_response<TIndex, TType, TId>(res: BulkResponse<TIndex, TType, TId>) {
 
 }
 
@@ -139,11 +150,18 @@ fn takes_default_response(res: BulkResponse) {
 ```
 */
 #[derive(Deserialize, Debug, Clone)]
-#[serde(bound(deserialize = "TIndex: Deserialize<'de>, TType: Deserialize<'de>, TId: Deserialize<'de>"))]
-pub struct BulkResponse<TIndex = DefaultAllocatedField, TType = DefaultAllocatedField, TId = DefaultAllocatedField> {
+#[serde(bound(
+    deserialize = "TIndex: Deserialize<'de>, TType: Deserialize<'de>, TId: Deserialize<'de>"
+))]
+pub struct BulkResponse<
+    TIndex = DefaultAllocatedField,
+    TType = DefaultAllocatedField,
+    TId = DefaultAllocatedField,
+> {
     took: u64,
     errors: bool,
-    #[serde(deserialize_with = "deserialize_bulk_items")] items: Vec<ItemResult<TIndex, TType, TId>>,
+    #[serde(deserialize_with = "deserialize_bulk_items")]
+    items: Vec<ItemResult<TIndex, TType, TId>>,
 }
 
 impl<TIndex, TType, TId> BulkResponse<TIndex, TType, TId> {
@@ -164,23 +182,23 @@ impl<TIndex, TType, TId> BulkResponse<TIndex, TType, TId> {
 
     /**
     Iterate through the bulk items.
-    
+
     The items in this iterator are a standard `Result` where `Ok` means the item succeeded
     and `Err` means it failed.
-    
+
     To move out of the items in a `BulkResponse` instead of borrowing them, call `into_iter`.
-    
+
     # Examples
-    
+
     Iterate through the individual items in a `BulkResponse`:
-    
+
     ```no_run
     # extern crate elastic_responses;
     # use elastic_responses::*;
     # fn do_request() -> BulkResponse { unimplemented!() }
     # fn main() {
     let response: BulkResponse = do_request();
-    
+
     // Iterate through all items
     for item in response.iter() {
         match item {
@@ -256,7 +274,7 @@ let response: BulkErrorsResponse = do_request();
 for item in response {
     match item.action() {
         Action::Delete => (), // Ignore failed deletes
-        _ => println!("err: {:?}", item) 
+        _ => println!("err: {:?}", item)
     }
 }
 # }
@@ -290,7 +308,7 @@ Otherwise the function will only accept a default `BulkErrorsResponse`:
 ```
 # use elastic_responses::*;
 // Do: Supports any BulkErrorsResponse
-fn takes_any_response<TIndex, TType, TId>(res: BulkErrorsResponse<TIndex, TType, TId>) { 
+fn takes_any_response<TIndex, TType, TId>(res: BulkErrorsResponse<TIndex, TType, TId>) {
 
 }
 
@@ -301,11 +319,18 @@ fn takes_default_response(res: BulkErrorsResponse) {
 ```
 */
 #[derive(Deserialize, Debug, Clone)]
-#[serde(bound(deserialize = "TIndex: Deserialize<'de>, TType: Deserialize<'de>, TId: Deserialize<'de>"))]
-pub struct BulkErrorsResponse<TIndex = DefaultAllocatedField, TType = DefaultAllocatedField, TId = DefaultAllocatedField> {
+#[serde(bound(
+    deserialize = "TIndex: Deserialize<'de>, TType: Deserialize<'de>, TId: Deserialize<'de>"
+))]
+pub struct BulkErrorsResponse<
+    TIndex = DefaultAllocatedField,
+    TType = DefaultAllocatedField,
+    TId = DefaultAllocatedField,
+> {
     took: u64,
     errors: bool,
-    #[serde(deserialize_with = "deserialize_bulk_item_errors")] items: Vec<ErrorItem<TIndex, TType, TId>>,
+    #[serde(deserialize_with = "deserialize_bulk_item_errors")]
+    items: Vec<ErrorItem<TIndex, TType, TId>>,
 }
 
 impl<TIndex, TType, TId> IntoIterator for BulkErrorsResponse<TIndex, TType, TId> {
@@ -355,22 +380,22 @@ impl<TIndex, TType, TId> BulkErrorsResponse<TIndex, TType, TId> {
         self.errors
     }
 
-    /** 
+    /**
     Iterate through the bulk item errors.
-    
+
     Items in this iterator all all errors that occurred while handling the bulk request.
-    
+
     # Examples
-    
+
     Iterate through the individual items in a `BulkErrorsResponse`:
-    
+
     ```no_run
     # extern crate elastic_responses;
     # use elastic_responses::*;
     # fn do_request() -> BulkErrorsResponse { unimplemented!() }
     # fn main() {
     let response: BulkErrorsResponse = do_request();
-    
+
     // Iterate through all items
     for item in response.iter() {
         // Do something with failed items
@@ -384,12 +409,18 @@ impl<TIndex, TType, TId> BulkErrorsResponse<TIndex, TType, TId> {
     }
 }
 
-type ItemResult<TIndex, TType, TId> = Result<OkItem<TIndex, TType, TId>, ErrorItem<TIndex, TType, TId>>;
-type ItemResultBrw<'a, TIndex, TType, TId> = Result<&'a OkItem<TIndex, TType, TId>, &'a ErrorItem<TIndex, TType, TId>>;
+type ItemResult<TIndex, TType, TId> =
+    Result<OkItem<TIndex, TType, TId>, ErrorItem<TIndex, TType, TId>>;
+type ItemResultBrw<'a, TIndex, TType, TId> =
+    Result<&'a OkItem<TIndex, TType, TId>, &'a ErrorItem<TIndex, TType, TId>>;
 
 /** A successful bulk response item. */
 #[derive(Debug, Clone)]
-pub struct OkItem<TIndex = DefaultAllocatedField, TType = DefaultAllocatedField, TId = DefaultAllocatedField> {
+pub struct OkItem<
+    TIndex = DefaultAllocatedField,
+    TType = DefaultAllocatedField,
+    TId = DefaultAllocatedField,
+> {
     action: Action,
     index: TIndex,
     ty: TType,
@@ -410,9 +441,9 @@ impl<TIndex, TType, TId> OkItem<TIndex, TType, TId> {
         self.version.clone()
     }
 
-    /** 
+    /**
     Whether or not this item created the document.
-    
+
     `created` will only be `true` if the action is `Index` and the document didn't already exist.
     */
     pub fn created(&self) -> bool {
@@ -422,9 +453,9 @@ impl<TIndex, TType, TId> OkItem<TIndex, TType, TId> {
         }
     }
 
-    /** 
+    /**
     Whether or not this item deleted the document.
-    
+
     `deleted` will only be `true` if the action is `Delete` and the document existed
     */
     pub fn deleted(&self) -> bool {
@@ -452,7 +483,11 @@ impl<TIndex, TType, TId> OkItem<TIndex, TType, TId> {
 
 /** A failed bulk response item. */
 #[derive(Debug, Clone)]
-pub struct ErrorItem<TIndex = DefaultAllocatedField, TType = DefaultAllocatedField, TId = DefaultAllocatedField> {
+pub struct ErrorItem<
+    TIndex = DefaultAllocatedField,
+    TType = DefaultAllocatedField,
+    TId = DefaultAllocatedField,
+> {
     action: Action,
     index: TIndex,
     ty: TType,
@@ -515,10 +550,14 @@ where
 /** The bulk action being performed. */
 #[derive(Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
 pub enum Action {
-    #[serde(rename = "index")] Index,
-    #[serde(rename = "create")] Create,
-    #[serde(rename = "update")] Update,
-    #[serde(rename = "delete")] Delete,
+    #[serde(rename = "index")]
+    Index,
+    #[serde(rename = "create")]
+    Create,
+    #[serde(rename = "update")]
+    Update,
+    #[serde(rename = "delete")]
+    Delete,
 }
 
 impl<TIndex, TType, TId> IsOkOnSuccess for BulkResponse<TIndex, TType, TId> {}
@@ -534,11 +573,16 @@ struct ItemDe<TIndex, TType, TId> {
 
 #[derive(Deserialize, Debug, Clone)]
 struct ItemDeInner<TIndex, TType, TId> {
-    #[serde(rename = "_index")] index: TIndex,
-    #[serde(rename = "_type")] ty: TType,
-    #[serde(rename = "_id")] id: TId,
-    #[serde(rename = "_version")] version: Option<u32>,
-    #[serde(rename = "_shards")] shards: Option<Shards>,
+    #[serde(rename = "_index")]
+    index: TIndex,
+    #[serde(rename = "_type")]
+    ty: TType,
+    #[serde(rename = "_id")]
+    id: TId,
+    #[serde(rename = "_version")]
+    version: Option<u32>,
+    #[serde(rename = "_shards")]
+    shards: Option<Shards>,
     result: Option<DocumentResult>,
     status: u16,
     error: Option<BulkError>,
@@ -629,7 +673,9 @@ where
     }
 }
 
-fn deserialize_bulk_items<'de, D, TIndex, TType, TId>(deserializer: D) -> Result<Vec<ItemResult<TIndex, TType, TId>>, D::Error>
+fn deserialize_bulk_items<'de, D, TIndex, TType, TId>(
+    deserializer: D,
+) -> Result<Vec<ItemResult<TIndex, TType, TId>>, D::Error>
 where
     D: Deserializer<'de>,
     TIndex: Deserialize<'de>,
@@ -661,7 +707,10 @@ where
         }
 
         #[inline]
-        fn visit_seq<V>(self, mut visitor: V) -> Result<Vec<ItemResult<TIndex, TType, TId>>, V::Error>
+        fn visit_seq<V>(
+            self,
+            mut visitor: V,
+        ) -> Result<Vec<ItemResult<TIndex, TType, TId>>, V::Error>
         where
             V: SeqAccess<'de>,
         {
@@ -680,7 +729,9 @@ where
     })
 }
 
-fn deserialize_bulk_item_errors<'de, D, TIndex, TType, TId>(deserializer: D) -> Result<Vec<ErrorItem<TIndex, TType, TId>>, D::Error>
+fn deserialize_bulk_item_errors<'de, D, TIndex, TType, TId>(
+    deserializer: D,
+) -> Result<Vec<ErrorItem<TIndex, TType, TId>>, D::Error>
 where
     D: Deserializer<'de>,
     TIndex: Deserialize<'de>,
@@ -712,7 +763,10 @@ where
         }
 
         #[inline]
-        fn visit_seq<V>(self, mut visitor: V) -> Result<Vec<ErrorItem<TIndex, TType, TId>>, V::Error>
+        fn visit_seq<V>(
+            self,
+            mut visitor: V,
+        ) -> Result<Vec<ErrorItem<TIndex, TType, TId>>, V::Error>
         where
             V: SeqAccess<'de>,
         {
diff --git a/src/responses/src/command.rs b/src/responses/src/command.rs
index 38a099017c..6c6f70af88 100644
--- a/src/responses/src/command.rs
+++ b/src/responses/src/command.rs
@@ -11,9 +11,9 @@ pub struct CommandResponse {
 }
 
 impl CommandResponse {
-    /** 
+    /**
     Whether or not the request was acknowledged.
-    
+
     This doesn't necessarily mean the request has been fully processed.
     */
     pub fn acknowledged(&self) -> bool {
diff --git a/src/responses/src/common.rs b/src/responses/src/common.rs
index fd2727fcff..b969a3995b 100644
--- a/src/responses/src/common.rs
+++ b/src/responses/src/common.rs
@@ -28,9 +28,14 @@ impl Shards {
 
 #[derive(Clone, Copy, Deserialize, Debug, PartialEq, Eq)]
 pub(crate) enum DocumentResult {
-    #[serde(rename = "deleted")] Deleted,
-    #[serde(rename = "updated")] Updated,
-    #[serde(rename = "not_found")] NotFound,
-    #[serde(rename = "noop")] NoOp,
-    #[serde(rename = "created")] Created,
+    #[serde(rename = "deleted")]
+    Deleted,
+    #[serde(rename = "updated")]
+    Updated,
+    #[serde(rename = "not_found")]
+    NotFound,
+    #[serde(rename = "noop")]
+    NoOp,
+    #[serde(rename = "created")]
+    Created,
 }
diff --git a/src/responses/src/delete.rs b/src/responses/src/delete.rs
index 26f78dd959..7c734c2145 100644
--- a/src/responses/src/delete.rs
+++ b/src/responses/src/delete.rs
@@ -4,18 +4,29 @@ Response types for a [delete document request](https://www.elastic.co/guide/en/e
 
 use http::StatusCode;
 
-use parsing::{HttpResponseHead, IsOk, MaybeOkResponse, ResponseBody, Unbuffered};
 use common::DocumentResult;
 use error::*;
+use parsing::{
+    HttpResponseHead,
+    IsOk,
+    MaybeOkResponse,
+    ResponseBody,
+    Unbuffered,
+};
 
 /** Response for a [delete document request](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html). */
 #[derive(Deserialize, Debug)]
 pub struct DeleteResponse {
-    #[serde(rename = "_index")] index: String,
-    #[serde(rename = "_type")] ty: String,
-    #[serde(rename = "_id")] id: String,
-    #[serde(rename = "_version")] version: Option<u32>,
-    #[serde(rename = "_routing")] routing: Option<String>,
+    #[serde(rename = "_index")]
+    index: String,
+    #[serde(rename = "_type")]
+    ty: String,
+    #[serde(rename = "_id")]
+    id: String,
+    #[serde(rename = "_version")]
+    version: Option<u32>,
+    #[serde(rename = "_routing")]
+    routing: Option<String>,
     result: DocumentResult,
 }
 
@@ -50,9 +61,14 @@ impl DeleteResponse {
 }
 
 impl IsOk for DeleteResponse {
-    fn is_ok<B: ResponseBody>(head: HttpResponseHead, body: Unbuffered<B>) -> Result<MaybeOkResponse<B>, ParseError> {
+    fn is_ok<B: ResponseBody>(
+        head: HttpResponseHead,
+        body: Unbuffered<B>,
+    ) -> Result<MaybeOkResponse<B>, ParseError> {
         match head.status() {
-            status if status.is_success() || status == StatusCode::NOT_FOUND => Ok(MaybeOkResponse::ok(body)),
+            status if status.is_success() || status == StatusCode::NOT_FOUND => {
+                Ok(MaybeOkResponse::ok(body))
+            }
             _ => Ok(MaybeOkResponse::err(body)),
         }
     }
diff --git a/src/responses/src/error.rs b/src/responses/src/error.rs
index 80296ae594..e5b4cd0344 100644
--- a/src/responses/src/error.rs
+++ b/src/responses/src/error.rs
@@ -2,16 +2,26 @@
 Error types from Elasticsearch.
 */
 
-use serde::{Deserialize, Deserializer};
-use serde_json::{Error as JsonError, Map, Value};
+use serde::{
+    Deserialize,
+    Deserializer,
+};
+use serde_json::{
+    Error as JsonError,
+    Map,
+    Value,
+};
 use std::error::Error as StdError;
-use std::io::Error as IoError;
 use std::fmt;
+use std::io::Error as IoError;
 
 mod inner {
-    use std::fmt;
+    use serde_json::{
+        Map,
+        Value,
+    };
     use std::error::Error as StdError;
-    use serde_json::{Map, Value};
+    use std::fmt;
 
     use super::ApiError;
 
@@ -36,7 +46,7 @@ mod inner {
 
     pub enum ParsedApiError {
         Known(ApiError),
-        Unknown(Map<String, Value>)
+        Unknown(Map<String, Value>),
     }
 }
 
@@ -51,9 +61,12 @@ pub struct ParseError {
 }
 
 impl ParseError {
-    pub fn new<E>(err: E) -> Self where E: StdError + Send + Sync + 'static {
+    pub fn new<E>(err: E) -> Self
+    where
+        E: StdError + Send + Sync + 'static,
+    {
         ParseError {
-            inner: Box::new(err)
+            inner: Box::new(err),
         }
     }
 }
@@ -148,17 +161,17 @@ quick_error! {
 }
 
 macro_rules! error_key {
-    ($obj:ident [ $key:ident ] : |$cast:ident| $cast_expr:expr) => ({
-            let key = $obj.get(stringify!($key))
-                          .and_then(|$cast| $cast_expr)
-                          .map(|v| v.to_owned());
-
-            match key {
-                Some(v) => v,
-                _ => return ParsedApiError::Unknown($obj)
-            }
+    ($obj:ident [ $key:ident ] : |$cast:ident| $cast_expr:expr) => {{
+        let key = $obj
+            .get(stringify!($key))
+            .and_then(|$cast| $cast_expr)
+            .map(|v| v.to_owned());
+
+        match key {
+            Some(v) => v,
+            _ => return ParsedApiError::Unknown($obj),
         }
-    )
+    }};
 }
 
 impl<'de> Deserialize<'de> for ParsedApiError {
@@ -182,7 +195,8 @@ impl From<Map<String, Value>> for ParsedApiError {
         };
 
         let ty = {
-            let ty = obj.get("type")
+            let ty = obj
+                .get("type")
                 .and_then(|v| v.as_str())
                 .map(|v| v.to_owned());
 
diff --git a/src/responses/src/get.rs b/src/responses/src/get.rs
index 0c8fc18067..c091fa043e 100644
--- a/src/responses/src/get.rs
+++ b/src/responses/src/get.rs
@@ -2,22 +2,34 @@
 Response types for a [get document request](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html).
 */
 
-use serde::de::DeserializeOwned;
 use http::StatusCode;
+use serde::de::DeserializeOwned;
 
-use parsing::{HttpResponseHead, IsOk, MaybeOkResponse, ResponseBody, Unbuffered};
 use error::*;
+use parsing::{
+    HttpResponseHead,
+    IsOk,
+    MaybeOkResponse,
+    ResponseBody,
+    Unbuffered,
+};
 
 /** Response for a [get document request](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html). */
 #[derive(Deserialize, Debug)]
 pub struct GetResponse<T> {
-    #[serde(rename = "_index")] index: String,
-    #[serde(rename = "_type")] ty: String,
-    #[serde(rename = "_id")] id: String,
-    #[serde(rename = "_version")] version: Option<u32>,
+    #[serde(rename = "_index")]
+    index: String,
+    #[serde(rename = "_type")]
+    ty: String,
+    #[serde(rename = "_id")]
+    id: String,
+    #[serde(rename = "_version")]
+    version: Option<u32>,
     found: bool,
-    #[serde(rename = "_source")] source: Option<T>,
-    #[serde(rename = "_routing")] routing: Option<String>,
+    #[serde(rename = "_source")]
+    source: Option<T>,
+    #[serde(rename = "_routing")]
+    routing: Option<String>,
 }
 
 impl<T> GetResponse<T> {
@@ -58,7 +70,10 @@ impl<T> GetResponse<T> {
 }
 
 impl<T: DeserializeOwned> IsOk for GetResponse<T> {
-    fn is_ok<B: ResponseBody>(head: HttpResponseHead, body: Unbuffered<B>) -> Result<MaybeOkResponse<B>, ParseError> {
+    fn is_ok<B: ResponseBody>(
+        head: HttpResponseHead,
+        body: Unbuffered<B>,
+    ) -> Result<MaybeOkResponse<B>, ParseError> {
         match head.status() {
             status if status.is_success() => Ok(MaybeOkResponse::ok(body)),
             StatusCode::NOT_FOUND => {
diff --git a/src/responses/src/index.rs b/src/responses/src/index.rs
index a6eedd457c..ff7c7c62f1 100644
--- a/src/responses/src/index.rs
+++ b/src/responses/src/index.rs
@@ -2,18 +2,26 @@
 Response types for an [index document request](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html).
 */
 
-use common::{DocumentResult, Shards};
+use common::{
+    DocumentResult,
+    Shards,
+};
 use parsing::IsOkOnSuccess;
 
 /** Response for an [index document request](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html). */
 #[derive(Deserialize, Debug)]
 pub struct IndexResponse {
-    #[serde(rename = "_index")] index: String,
-    #[serde(rename = "_type")] ty: String,
-    #[serde(rename = "_id")] id: String,
-    #[serde(rename = "_version")] version: Option<u32>,
+    #[serde(rename = "_index")]
+    index: String,
+    #[serde(rename = "_type")]
+    ty: String,
+    #[serde(rename = "_id")]
+    id: String,
+    #[serde(rename = "_version")]
+    version: Option<u32>,
     result: DocumentResult,
-    #[serde(rename = "_shards")] shards: Shards,
+    #[serde(rename = "_shards")]
+    shards: Shards,
 }
 
 impl IndexResponse {
diff --git a/src/responses/src/indices_exists.rs b/src/responses/src/indices_exists.rs
index 407ca34bb5..0ec5a7bd0b 100644
--- a/src/responses/src/indices_exists.rs
+++ b/src/responses/src/indices_exists.rs
@@ -2,14 +2,20 @@
 Response types for an [index exists request](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html).
 */
 
-use parsing::{HttpResponseHead, IsOk, MaybeOkResponse, ResponseBody, Unbuffered};
-use http::StatusCode;
 use error::*;
+use http::StatusCode;
+use parsing::{
+    HttpResponseHead,
+    IsOk,
+    MaybeOkResponse,
+    ResponseBody,
+    Unbuffered,
+};
 
 /** Response for an [index exists request](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html). */
 #[derive(Deserialize, Debug)]
 pub struct IndicesExistsResponse {
-    exists: bool
+    exists: bool,
 }
 
 impl IndicesExistsResponse {
@@ -20,7 +26,10 @@ impl IndicesExistsResponse {
 }
 
 impl IsOk for IndicesExistsResponse {
-    fn is_ok<B: ResponseBody>(head: HttpResponseHead, body: Unbuffered<B>) -> Result<MaybeOkResponse<B>, ParseError> {
+    fn is_ok<B: ResponseBody>(
+        head: HttpResponseHead,
+        body: Unbuffered<B>,
+    ) -> Result<MaybeOkResponse<B>, ParseError> {
         match head.status() {
             status if status.is_success() => Ok(MaybeOkResponse::ok(json!({ "exists": true }))),
             StatusCode::NOT_FOUND => Ok(MaybeOkResponse::ok(json!({ "exists": false }))),
diff --git a/src/responses/src/lib.rs b/src/responses/src/lib.rs
index 89853b3dd4..5e4c1315dd 100644
--- a/src/responses/src/lib.rs
+++ b/src/responses/src/lib.rs
@@ -42,7 +42,7 @@ let response = parse::<SearchResponse<Value>>().from_slice(response_status, resp
 for hit in response.hits() {
     let score = hit.score().unwrap_or(f32::default());
     let doc = hit.document();
-    
+
     println!("score: {}", score);
     println!("doc: {:?}", doc);
 }
@@ -51,7 +51,7 @@ for hit in response.hits() {
 for agg in response.aggs() {
     let min_ack_pkts = agg["min_ack_pkts_sent"].as_u64().unwrap();
     let max_ack_pkts = agg["max_ack_pkts_sent"].as_u64().unwrap();
-    
+
     println!("min: {}, max: {}", min_ack_pkts, max_ack_pkts);
 }
 # }
@@ -140,27 +140,30 @@ extern crate serde_json;
 pub mod error;
 pub mod parsing;
 
-mod common;
+pub mod bulk;
 mod command;
-mod ping;
-mod get;
+mod common;
 mod delete;
-mod update;
-pub mod search;
-pub mod bulk;
+mod get;
 mod index;
+mod ping;
+pub mod search;
+mod update;
 
 mod indices_exists;
 
-pub use self::common::*;
+pub use self::bulk::{
+    BulkErrorsResponse,
+    BulkResponse,
+};
 pub use self::command::*;
-pub use self::ping::*;
-pub use self::get::*;
+pub use self::common::*;
 pub use self::delete::*;
-pub use self::update::*;
-pub use self::search::SearchResponse;
-pub use self::bulk::{BulkErrorsResponse, BulkResponse};
+pub use self::get::*;
 pub use self::index::*;
+pub use self::ping::*;
+pub use self::search::SearchResponse;
+pub use self::update::*;
 
 pub use self::indices_exists::*;
 
diff --git a/src/responses/src/parsing.rs b/src/responses/src/parsing.rs
index b07da5bece..01d1a4d0cf 100644
--- a/src/responses/src/parsing.rs
+++ b/src/responses/src/parsing.rs
@@ -1,12 +1,18 @@
-/*! 
+/*!
 Response type parsing.
 */
 
-use std::marker::PhantomData;
-use std::io::{Cursor, Read};
-use serde::de::DeserializeOwned;
-use serde_json::{self, Value};
 use http::StatusCode;
+use serde::de::DeserializeOwned;
+use serde_json::{
+    self,
+    Value,
+};
+use std::io::{
+    Cursor,
+    Read,
+};
+use std::marker::PhantomData;
 
 use error::*;
 
@@ -15,7 +21,7 @@ pub struct Parse<T> {
     _marker: PhantomData<T>,
 }
 
-/* 
+/*
 Try parse a http response into a concrete type.
 
 Parsing is split between two calls:
@@ -84,17 +90,28 @@ pub fn parse<T: IsOk + DeserializeOwned>() -> Parse<T> {
 
 impl<T: IsOk + DeserializeOwned> Parse<T> {
     /** Try parse a contiguous slice of bytes into a concrete response. */
-    pub fn from_slice<B: AsRef<[u8]>, H: Into<HttpResponseHead>>(self, head: H, body: B) -> Result<T, ResponseError> {
+    pub fn from_slice<B: AsRef<[u8]>, H: Into<HttpResponseHead>>(
+        self,
+        head: H,
+        body: B,
+    ) -> Result<T, ResponseError> {
         from_body(head.into(), SliceBody(body))
     }
 
     /** Try parse an arbitrary reader into a concrete response. */
-    pub fn from_reader<B: Read, H: Into<HttpResponseHead>>(self, head: H, body: B) -> Result<T, ResponseError> {
+    pub fn from_reader<B: Read, H: Into<HttpResponseHead>>(
+        self,
+        head: H,
+        body: B,
+    ) -> Result<T, ResponseError> {
         from_body(head.into(), ReadBody(body))
     }
 }
 
-fn from_body<B: ResponseBody, T: IsOk + DeserializeOwned>(head: HttpResponseHead, body: B) -> Result<T, ResponseError> {
+fn from_body<B: ResponseBody, T: IsOk + DeserializeOwned>(
+    head: HttpResponseHead,
+    body: B,
+) -> Result<T, ResponseError> {
     let maybe = T::is_ok(head, Unbuffered(body))?;
 
     match maybe.ok {
@@ -166,7 +183,7 @@ impl<B: Read> ResponseBody for ReadBody<B> {
     fn parse_err(self) -> Result<ApiError, ParseError> {
         match serde_json::from_reader(self.0)? {
             ParsedApiError::Known(err) => Ok(err),
-            ParsedApiError::Unknown(err) => Err(ParseError::new(UnknownApiError(err)))
+            ParsedApiError::Unknown(err) => Err(ParseError::new(UnknownApiError(err))),
         }
     }
 }
@@ -191,7 +208,7 @@ impl<B: AsRef<[u8]>> ResponseBody for SliceBody<B> {
     fn parse_err(self) -> Result<ApiError, ParseError> {
         match serde_json::from_slice(self.0.as_ref())? {
             ParsedApiError::Known(err) => Ok(err),
-            ParsedApiError::Unknown(err) => Err(ParseError::new(UnknownApiError(err)))
+            ParsedApiError::Unknown(err) => Err(ParseError::new(UnknownApiError(err))),
         }
     }
 }
@@ -212,7 +229,7 @@ impl ResponseBody for Value {
     fn parse_err(self) -> Result<ApiError, ParseError> {
         match serde_json::from_value(self)? {
             ParsedApiError::Known(err) => Ok(err),
-            ParsedApiError::Unknown(err) => Err(ParseError::new(UnknownApiError(err)))
+            ParsedApiError::Unknown(err) => Err(ParseError::new(UnknownApiError(err))),
         }
     }
 }
@@ -274,7 +291,10 @@ impl IsOk for MyResponse {
 */
 pub trait IsOk {
     /** Inspect the http response to determine whether or not it succeeded. */
-    fn is_ok<B: ResponseBody>(head: HttpResponseHead, unbuffered: Unbuffered<B>) -> Result<MaybeOkResponse<B>, ParseError>;
+    fn is_ok<B: ResponseBody>(
+        head: HttpResponseHead,
+        unbuffered: Unbuffered<B>,
+    ) -> Result<MaybeOkResponse<B>, ParseError>;
 }
 
 /**
@@ -283,7 +303,10 @@ A convenient trait that automatically derives `IsOk` if the status code is in th
 pub trait IsOkOnSuccess {}
 
 impl<T: IsOkOnSuccess> IsOk for T {
-    fn is_ok<B: ResponseBody>(head: HttpResponseHead, body: Unbuffered<B>) -> Result<MaybeOkResponse<B>, ParseError> {
+    fn is_ok<B: ResponseBody>(
+        head: HttpResponseHead,
+        body: Unbuffered<B>,
+    ) -> Result<MaybeOkResponse<B>, ParseError> {
         if head.status().is_success() {
             Ok(MaybeOkResponse::ok(body))
         } else {
@@ -307,7 +330,7 @@ impl<B> MaybeOkResponse<B>
 where
     B: ResponseBody,
 {
-    /** 
+    /**
     Create a new response that indicates where or not the
     body is successful or an `ApiError`.
     */
@@ -351,7 +374,7 @@ impl<B: ResponseBody> Unbuffered<B> {
 /** A response body that has been buffered. */
 pub struct Buffered<B: ResponseBody>(B::Buffered);
 
-/** 
+/**
 A response body that may or may not have been buffered.
 
 This type makes it possible to inspect the response body for
diff --git a/src/responses/src/ping.rs b/src/responses/src/ping.rs
index 70edb7a30d..7037f121d1 100644
--- a/src/responses/src/ping.rs
+++ b/src/responses/src/ping.rs
@@ -1,4 +1,4 @@
-/*! 
+/*!
 Response types for a cluster ping request.
 */
 
diff --git a/src/responses/src/search.rs b/src/responses/src/search.rs
index 7c3b7e5b13..bbfb89eb1e 100644
--- a/src/responses/src/search.rs
+++ b/src/responses/src/search.rs
@@ -1,9 +1,12 @@
-/*! 
+/*!
 Response types for a [search request](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html).
 */
 
 use serde::de::DeserializeOwned;
-use serde_json::{Map, Value};
+use serde_json::{
+    Map,
+    Value,
+};
 
 use common::Shards;
 use parsing::IsOkOnSuccess;
@@ -13,7 +16,7 @@ use std::collections::BTreeMap;
 use std::slice::Iter;
 use std::vec::IntoIter;
 
-/** 
+/**
 Response for a [search request][search-req].
 
 This is the main `struct` of the crate, provides access to the `hits` and `aggs` iterators.
@@ -40,7 +43,7 @@ let response: SearchResponse<Value> = do_request();
 for hit in response.hits() {
     let score = hit.score().unwrap_or(f32::default());
     let doc = hit.document();
-    
+
     println!("score: {}", score);
     println!("doc: {:?}", doc);
 }
@@ -55,7 +58,8 @@ for hit in response.hits() {
 pub struct SearchResponse<T> {
     took: u64,
     timed_out: bool,
-    #[serde(rename = "_shards")] shards: Shards,
+    #[serde(rename = "_shards")]
+    shards: Shards,
     hits: HitsWrapper<T>,
     aggregations: Option<AggsWrapper>,
     status: Option<u16>,
@@ -66,7 +70,8 @@ pub struct SearchResponse<T> {
 struct HitsWrapper<T> {
     total: u64,
     max_score: Option<f32>,
-    #[serde(rename = "hits")] inner: Vec<Hit<T>>,
+    #[serde(rename = "hits")]
+    inner: Vec<Hit<T>>,
 }
 
 impl<T> SearchResponse<T> {
@@ -110,9 +115,9 @@ impl<T> SearchResponse<T> {
         IntoHits::new(self.hits)
     }
 
-    /** 
+    /**
     Iterate over the documents matched by the search query.
-    
+
     This iterator emits just the `_source` field for the returned hits.
     */
     pub fn documents(&self) -> Documents<T> {
@@ -124,9 +129,9 @@ impl<T> SearchResponse<T> {
         IntoDocuments::new(self.hits)
     }
 
-    /** 
+    /**
     Iterate over the aggregations in the response.
-    
+
     This Iterator transforms the tree-like JSON object into a row/table based format for use with standard iterator adaptors.
     */
     pub fn aggs(&self) -> Aggs {
@@ -230,12 +235,18 @@ impl<T> Iterator for IntoDocuments<T> {
 /** Full metadata and source for a single hit. */
 #[derive(Deserialize, Debug)]
 pub struct Hit<T> {
-    #[serde(rename = "_index")] index: String,
-    #[serde(rename = "_type")] ty: String,
-    #[serde(rename = "_version")] version: Option<u32>,
-    #[serde(rename = "_score")] score: Option<f32>,
-    #[serde(rename = "_source")] source: Option<T>,
-    #[serde(rename = "_routing")] routing: Option<String>,
+    #[serde(rename = "_index")]
+    index: String,
+    #[serde(rename = "_type")]
+    ty: String,
+    #[serde(rename = "_version")]
+    version: Option<u32>,
+    #[serde(rename = "_score")]
+    score: Option<f32>,
+    #[serde(rename = "_source")]
+    source: Option<T>,
+    #[serde(rename = "_routing")]
+    routing: Option<String>,
 }
 
 impl<T> Hit<T> {
@@ -274,7 +285,7 @@ impl<T> Hit<T> {
 #[derive(Deserialize, Debug)]
 struct AggsWrapper(Value);
 
-/** 
+/**
 Aggregator that traverses the results from Elasticsearch's aggregations and returns a result row by row in a table-styled fashion.
 */
 #[derive(Debug)]
@@ -288,7 +299,8 @@ impl<'a> Aggs<'a> {
     fn new(aggregations: Option<&'a AggsWrapper>) -> Aggs<'a> {
         let iter_stack = {
             match aggregations.and_then(|aggs| aggs.0.as_object()) {
-                Some(o) => o.into_iter()
+                Some(o) => o
+                    .into_iter()
                     .filter_map(|(key, child)| {
                         child
                             .as_object()
@@ -312,7 +324,12 @@ impl<'a> Aggs<'a> {
 type Object = Map<String, Value>;
 type RowData<'a> = BTreeMap<Cow<'a, str>, &'a Value>;
 
-fn insert_value<'a>(fieldname: &str, json_object: &'a Object, keyname: &str, rowdata: &mut RowData<'a>) {
+fn insert_value<'a>(
+    fieldname: &str,
+    json_object: &'a Object,
+    keyname: &str,
+    rowdata: &mut RowData<'a>,
+) {
     if let Some(v) = json_object.get(fieldname) {
         let field_name = format!("{}_{}", keyname, fieldname);
         rowdata.insert(Cow::Owned(field_name), v);
@@ -366,7 +383,9 @@ impl<'a> Iterator for Aggs<'a> {
                                 insert_value("std_deviation", c, key, row);
 
                                 if c.contains_key("std_deviation_bounds") {
-                                    if let Some(child_values) = c.get("std_deviation_bounds").unwrap().as_object() {
+                                    if let Some(child_values) =
+                                        c.get("std_deviation_bounds").unwrap().as_object()
+                                    {
                                         let u = child_values.get("upper");
                                         let l = child_values.get("lower");
                                         let un = format!("{}_std_deviation_bounds_upper", key);
diff --git a/src/responses/src/update.rs b/src/responses/src/update.rs
index bf12f8cb99..561f54749e 100644
--- a/src/responses/src/update.rs
+++ b/src/responses/src/update.rs
@@ -2,17 +2,22 @@
 Response types for a [update document request](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html).
 */
 
-use parsing::IsOkOnSuccess;
 use common::DocumentResult;
+use parsing::IsOkOnSuccess;
 
 /** Response for a [update document request](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html). */
 #[derive(Deserialize, Debug)]
 pub struct UpdateResponse {
-    #[serde(rename = "_index")] index: String,
-    #[serde(rename = "_type")] ty: String,
-    #[serde(rename = "_id")] id: String,
-    #[serde(rename = "_version")] version: Option<u32>,
-    #[serde(rename = "_routing")] routing: Option<String>,
+    #[serde(rename = "_index")]
+    index: String,
+    #[serde(rename = "_type")]
+    ty: String,
+    #[serde(rename = "_id")]
+    id: String,
+    #[serde(rename = "_version")]
+    version: Option<u32>,
+    #[serde(rename = "_routing")]
+    routing: Option<String>,
     result: DocumentResult,
 }
 
diff --git a/src/types/benches/boolean/mod.rs b/src/types/benches/boolean/mod.rs
deleted file mode 100644
index 2ce314535a..0000000000
--- a/src/types/benches/boolean/mod.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-use elastic_types;
-use elastic_types::prelude::*;
-use boolean_fixtures::*;
-
-use test::Bencher;
-
-#[bench]
-fn mapping(b: &mut Bencher) {
-    b.iter(|| {
-        elastic_types::derive::standalone_field_ser(MyBooleanMapping).unwrap()
-    });
-}
diff --git a/src/types/benches/date/mod.rs b/src/types/benches/date/mod.rs
deleted file mode 100644
index d59f1e5ecc..0000000000
--- a/src/types/benches/date/mod.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-use serde_json;
-use elastic_types;
-use elastic_types::prelude::*;
-use date_fixtures::*;
-
-use test::Bencher;
-
-#[bench]
-fn parse_string(b: &mut Bencher) {
-    b.iter(|| {
-        serde_json::from_str::<Date<DefaultDateMapping<BasicDateTime>>>("\"20150620T134501.034Z\"").unwrap()
-    });
-}
-
-#[bench]
-fn fmt_string(b: &mut Bencher) {
-    let dt: Date<DefaultDateMapping> = Date::now();
-
-    b.iter(|| serde_json::to_string(&dt).unwrap());
-}
-
-#[bench]
-fn parse_epoch(b: &mut Bencher) {
-    b.iter(|| {
-        serde_json::from_str::<Date<DefaultDateMapping<EpochMillis>>>("\"1435935302478\"").unwrap()
-    });
-}
-
-#[bench]
-fn fmt_epoch(b: &mut Bencher) {
-    let dt = Date::<DefaultDateMapping<EpochMillis>>::now();
-
-    b.iter(|| serde_json::to_string(&dt).unwrap());
-}
-
-#[bench]
-fn mapping(b: &mut Bencher) {
-    b.iter(|| {
-        elastic_types::derive::standalone_field_ser(MyDateMapping).unwrap()
-    });
-}
diff --git a/src/types/benches/geo_point/mod.rs b/src/types/benches/geo_point/mod.rs
deleted file mode 100644
index d76a03929c..0000000000
--- a/src/types/benches/geo_point/mod.rs
+++ /dev/null
@@ -1,90 +0,0 @@
-use serde_json;
-use georust::{Coordinate, Point};
-use elastic_types;
-use elastic_types::prelude::*;
-use geo_point_fixtures::*;
-
-use test::Bencher;
-
-#[bench]
-fn parse_string(b: &mut Bencher) {
-    let ser = r#""41.12,-71.34""#;
-    b.iter(|| {
-        let point: GeoPoint<DefaultGeoPointMapping<GeoPointString>> = serde_json::from_str(ser).unwrap();
-        point
-    });
-}
-
-#[bench]
-fn fmt_string(b: &mut Bencher) {
-    let point = GeoPoint::<DefaultGeoPointMapping<GeoPointString>>::new(Point(Coordinate {
-        x: -71.34,
-        y: 41.12,
-    }));
-
-    b.iter(|| serde_json::to_string(&point).unwrap());
-}
-
-#[bench]
-fn parse_object(b: &mut Bencher) {
-    let ser = r#"{"lat":41,"lon":-71.34}"#;
-    b.iter(|| {
-        let point: GeoPoint<DefaultGeoPointMapping<GeoPointObject>> = serde_json::from_str(ser).unwrap();
-        point
-    });
-}
-
-#[bench]
-fn fmt_object(b: &mut Bencher) {
-    let point = GeoPoint::<DefaultGeoPointMapping<GeoPointObject>>::new(Point(Coordinate {
-        x: -71.34,
-        y: 41.12,
-    }));
-
-    b.iter(|| serde_json::to_string(&point).unwrap());
-}
-
-#[bench]
-fn parse_hash(b: &mut Bencher) {
-    let ser = r#""drm3btev3e86""#;
-    b.iter(|| {
-        let point: GeoPoint<DefaultGeoPointMapping<GeoPointHash>> = serde_json::from_str(ser).unwrap();
-        point
-    });
-}
-
-#[bench]
-fn fmt_hash(b: &mut Bencher) {
-    let point = GeoPoint::<DefaultGeoPointMapping<GeoPointHash>>::new(Point(Coordinate {
-        x: -71.34,
-        y: 41.12,
-    }));
-
-    b.iter(|| serde_json::to_string(&point).unwrap());
-}
-
-#[bench]
-fn parse_array(b: &mut Bencher) {
-    let ser = r#"[-71.34,41]"#;
-    b.iter(|| {
-        let point: GeoPoint<DefaultGeoPointMapping<GeoPointArray>> = serde_json::from_str(ser).unwrap();
-        point
-    });
-}
-
-#[bench]
-fn fmt_array(b: &mut Bencher) {
-    let point = GeoPoint::<DefaultGeoPointMapping<GeoPointArray>>::new(Point(Coordinate {
-        x: -71.34,
-        y: 41.12,
-    }));
-
-    b.iter(|| serde_json::to_string(&point).unwrap());
-}
-
-#[bench]
-fn mapping(b: &mut Bencher) {
-    b.iter(|| {
-        elastic_types::derive::standalone_field_ser(MyGeoPointMapping).unwrap()
-    });
-}
diff --git a/src/types/benches/geo_shape/mod.rs b/src/types/benches/geo_shape/mod.rs
deleted file mode 100644
index 1a94348441..0000000000
--- a/src/types/benches/geo_shape/mod.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-use elastic_types;
-use elastic_types::prelude::*;
-use geo_shape_fixtures::*;
-
-use test::Bencher;
-
-#[bench]
-fn mapping(b: &mut Bencher) {
-    b.iter(|| {
-        elastic_types::derive::standalone_field_ser(MyGeoShapeMapping).unwrap()
-    });
-}
diff --git a/src/types/benches/ip/mod.rs b/src/types/benches/ip/mod.rs
deleted file mode 100644
index 8cad10c9fb..0000000000
--- a/src/types/benches/ip/mod.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-use serde_json;
-use elastic_types;
-use elastic_types::prelude::*;
-use ::ip_fixtures::*;
-
-use test::Bencher;
-
-#[bench]
-fn mapping(b: &mut Bencher) {
-    b.iter(|| {
-        elastic_types::derive::standalone_field_ser(MyIpMapping).unwrap()
-    });
-}
diff --git a/src/types/benches/mod.rs b/src/types/benches/mod.rs
deleted file mode 100644
index 2a07a8991b..0000000000
--- a/src/types/benches/mod.rs
+++ /dev/null
@@ -1,639 +0,0 @@
-#![feature(test)]
-
-extern crate geo as georust;
-extern crate geojson;
-extern crate serde;
-extern crate serde_json;
-extern crate test;
-#[macro_use]
-extern crate json_str;
-pub extern crate chrono;
-
-extern crate elastic_types;
-#[macro_use]
-extern crate elastic_types_derive;
-
-pub mod date_fixtures {
-    use elastic_types::prelude::*;
-
-    #[derive(Default, Clone)]
-    pub struct MyDateMapping;
-    impl DateMapping for MyDateMapping {
-        type Format = EpochMillis;
-
-        fn null_value() -> Option<Date<Self>> {
-            Some(Date::build(2015, 3, 14, 16, 45, 13, 778))
-        }
-
-        fn boost() -> Option<f32> {
-            Some(1.01)
-        }
-
-        fn index() -> Option<bool> {
-            Some(true)
-        }
-
-        fn doc_values() -> Option<bool> {
-            Some(true)
-        }
-
-        fn include_in_all() -> Option<bool> {
-            Some(false)
-        }
-
-        fn store() -> Option<bool> {
-            Some(true)
-        }
-
-        fn ignore_malformed() -> Option<bool> {
-            Some(true)
-        }
-    }
-}
-
-pub mod string_fixtures {
-    use std::collections::BTreeMap;
-    use elastic_types::prelude::*;
-
-    #[derive(Default, Clone)]
-    pub struct MyTextMapping;
-    impl TextMapping for MyTextMapping {
-        fn fields() -> Option<BTreeMap<&'static str, StringField>> {
-            let mut fields = BTreeMap::new();
-
-            fields.insert(
-                "raw",
-                StringField::Keyword(KeywordFieldMapping {
-                    analyzer: Some("my_analyzer"),
-                    ..Default::default()
-                }),
-            );
-
-            fields.insert(
-                "count",
-                StringField::TokenCount(ElasticTokenCountFieldMapping::default()),
-            );
-
-            fields.insert(
-                "comp",
-                StringField::Completion(ElasticCompletionFieldMapping::default()),
-            );
-
-            Some(fields)
-        }
-
-        fn fielddata_frequency_filter() -> Option<FieldDataFrequencyFilter> {
-            Some(FieldDataFrequencyFilter {
-                min: Some(0.0),
-                ..Default::default()
-            })
-        }
-
-        fn analyzer() -> Option<&'static str> {
-            Some("my_analyzer")
-        }
-
-        fn boost() -> Option<f32> {
-            Some(1.3)
-        }
-
-        fn eager_global_ordinals() -> Option<bool> {
-            Some(false)
-        }
-
-        fn fielddata() -> Option<bool> {
-            Some(true)
-        }
-
-        fn include_in_all() -> Option<bool> {
-            Some(true)
-        }
-
-        fn ignore_above() -> Option<u32> {
-            Some(512)
-        }
-
-        fn index() -> Option<bool> {
-            Some(false)
-        }
-
-        fn index_options() -> Option<IndexOptions> {
-            Some(IndexOptions::Freqs)
-        }
-
-        fn norms() -> Option<bool> {
-            Some(true)
-        }
-
-        fn position_increment_gap() -> Option<u32> {
-            Some(1)
-        }
-
-        fn store() -> Option<bool> {
-            Some(true)
-        }
-
-        fn search_analyzer() -> Option<&'static str> {
-            Some("my_analyzer")
-        }
-
-        fn search_quote_analyzer() -> Option<&'static str> {
-            Some("my_analyzer")
-        }
-
-        fn similarity() -> Option<&'static str> {
-            Some("BM25")
-        }
-
-        fn term_vector() -> Option<TermVector> {
-            Some(TermVector::Yes)
-        }
-    }
-
-    #[derive(Default, Clone)]
-    pub struct MyKeywordMapping;
-    impl KeywordMapping for MyKeywordMapping {
-        fn fields() -> Option<BTreeMap<&'static str, StringField>> {
-            let mut fields = BTreeMap::new();
-
-            fields.insert(
-                "text",
-                StringField::Text(TextFieldMapping {
-                    analyzer: Some("my_analyzer"),
-                    ..Default::default()
-                }),
-            );
-
-            fields.insert(
-                "count",
-                StringField::TokenCount(ElasticTokenCountFieldMapping::default()),
-            );
-
-            fields.insert(
-                "comp",
-                StringField::Completion(ElasticCompletionFieldMapping::default()),
-            );
-
-            Some(fields)
-        }
-
-        fn analyzer() -> Option<&'static str> {
-            Some("my_analyzer")
-        }
-
-        fn boost() -> Option<f32> {
-            Some(1.03)
-        }
-
-        fn doc_values() -> Option<bool> {
-            Some(true)
-        }
-
-        fn eager_global_ordinals() -> Option<bool> {
-            Some(false)
-        }
-
-        fn include_in_all() -> Option<bool> {
-            Some(false)
-        }
-
-        fn ignore_above() -> Option<u32> {
-            Some(256)
-        }
-
-        fn index() -> Option<bool> {
-            Some(true)
-        }
-
-        fn index_options() -> Option<IndexOptions> {
-            Some(IndexOptions::Docs)
-        }
-
-        fn norms() -> Option<bool> {
-            Some(false)
-        }
-
-        fn null_value() -> Option<&'static str> {
-            Some("my string")
-        }
-
-        fn store() -> Option<bool> {
-            Some(false)
-        }
-
-        fn search_analyzer() -> Option<&'static str> {
-            Some("my_analyzer")
-        }
-
-        fn similarity() -> Option<&'static str> {
-            Some("classic")
-        }
-    }
-}
-
-pub mod boolean_fixtures {
-    use elastic_types::prelude::*;
-
-    #[derive(Default, Clone)]
-    pub struct MyBooleanMapping;
-    impl BooleanMapping for MyBooleanMapping {
-        fn boost() -> Option<f32> {
-            Some(1.01)
-        }
-
-        fn index() -> Option<bool> {
-            Some(false)
-        }
-
-        fn doc_values() -> Option<bool> {
-            Some(true)
-        }
-
-        fn store() -> Option<bool> {
-            Some(true)
-        }
-
-        fn null_value() -> Option<bool> {
-            Some(false)
-        }
-    }
-}
-
-pub mod number_fixtures {
-    use elastic_types::prelude::*;
-
-    #[derive(Default, Clone)]
-    pub struct MyIntegerMapping;
-    impl IntegerMapping for MyIntegerMapping {
-        fn coerce() -> Option<bool> {
-            Some(true)
-        }
-
-        fn boost() -> Option<f32> {
-            Some(1.1)
-        }
-
-        fn doc_values() -> Option<bool> {
-            Some(false)
-        }
-
-        fn ignore_malformed() -> Option<bool> {
-            Some(true)
-        }
-
-        fn include_in_all() -> Option<bool> {
-            Some(true)
-        }
-
-        fn index() -> Option<bool> {
-            Some(false)
-        }
-
-        fn store() -> Option<bool> {
-            Some(true)
-        }
-
-        fn null_value() -> Option<i32> {
-            Some(42)
-        }
-    }
-
-    #[derive(Default, Clone)]
-    pub struct MyLongMapping;
-    impl LongMapping for MyLongMapping {
-        fn coerce() -> Option<bool> {
-            Some(true)
-        }
-
-        fn boost() -> Option<f32> {
-            Some(1.1)
-        }
-
-        fn doc_values() -> Option<bool> {
-            Some(false)
-        }
-
-        fn ignore_malformed() -> Option<bool> {
-            Some(true)
-        }
-
-        fn include_in_all() -> Option<bool> {
-            Some(true)
-        }
-
-        fn index() -> Option<bool> {
-            Some(false)
-        }
-
-        fn store() -> Option<bool> {
-            Some(true)
-        }
-
-        fn null_value() -> Option<i64> {
-            Some(-42)
-        }
-    }
-
-    #[derive(Default, Clone)]
-    pub struct MyShortMapping;
-    impl ShortMapping for MyShortMapping {
-        fn coerce() -> Option<bool> {
-            Some(true)
-        }
-
-        fn boost() -> Option<f32> {
-            Some(1.1)
-        }
-
-        fn doc_values() -> Option<bool> {
-            Some(false)
-        }
-
-        fn ignore_malformed() -> Option<bool> {
-            Some(true)
-        }
-
-        fn include_in_all() -> Option<bool> {
-            Some(true)
-        }
-
-        fn index() -> Option<bool> {
-            Some(false)
-        }
-
-        fn store() -> Option<bool> {
-            Some(true)
-        }
-
-        fn null_value() -> Option<i16> {
-            Some(42)
-        }
-    }
-
-    #[derive(Default, Clone)]
-    pub struct MyByteMapping;
-    impl ByteMapping for MyByteMapping {
-        fn coerce() -> Option<bool> {
-            Some(true)
-        }
-
-        fn boost() -> Option<f32> {
-            Some(1.1)
-        }
-
-        fn doc_values() -> Option<bool> {
-            Some(false)
-        }
-
-        fn ignore_malformed() -> Option<bool> {
-            Some(true)
-        }
-
-        fn include_in_all() -> Option<bool> {
-            Some(true)
-        }
-
-        fn index() -> Option<bool> {
-            Some(false)
-        }
-
-        fn store() -> Option<bool> {
-            Some(true)
-        }
-
-        fn null_value() -> Option<i8> {
-            Some(1)
-        }
-    }
-
-    #[derive(Default, Clone)]
-    pub struct MyFloatMapping;
-    impl FloatMapping for MyFloatMapping {
-        fn coerce() -> Option<bool> {
-            Some(true)
-        }
-
-        fn boost() -> Option<f32> {
-            Some(1.1)
-        }
-
-        fn doc_values() -> Option<bool> {
-            Some(false)
-        }
-
-        fn ignore_malformed() -> Option<bool> {
-            Some(true)
-        }
-
-        fn include_in_all() -> Option<bool> {
-            Some(true)
-        }
-
-        fn index() -> Option<bool> {
-            Some(false)
-        }
-
-        fn store() -> Option<bool> {
-            Some(true)
-        }
-
-        fn null_value() -> Option<f32> {
-            Some(1.04)
-        }
-    }
-
-    #[derive(Default, Clone)]
-    pub struct MyDoubleMapping;
-    impl DoubleMapping for MyDoubleMapping {
-        fn coerce() -> Option<bool> {
-            Some(true)
-        }
-
-        fn boost() -> Option<f32> {
-            Some(1.1)
-        }
-
-        fn doc_values() -> Option<bool> {
-            Some(false)
-        }
-
-        fn ignore_malformed() -> Option<bool> {
-            Some(true)
-        }
-
-        fn include_in_all() -> Option<bool> {
-            Some(true)
-        }
-
-        fn index() -> Option<bool> {
-            Some(false)
-        }
-
-        fn store() -> Option<bool> {
-            Some(true)
-        }
-
-        fn null_value() -> Option<f64> {
-            Some(-0.00002)
-        }
-    }
-}
-
-pub mod ip_fixtures {
-    use std::net::Ipv4Addr;
-    use elastic_types::prelude::*;
-
-    #[derive(Default, Clone)]
-    pub struct MyIpMapping;
-    impl IpMapping for MyIpMapping {
-        fn boost() -> Option<f32> {
-            Some(1.01)
-        }
-
-        fn index() -> Option<bool> {
-            Some(false)
-        }
-
-        fn doc_values() -> Option<bool> {
-            Some(true)
-        }
-
-        fn store() -> Option<bool> {
-            Some(true)
-        }
-
-        fn null_value() -> Option<Ipv4Addr> {
-            Some(Ipv4Addr::new(127, 0, 0, 1))
-        }
-    }
-}
-
-pub mod geo_point_fixtures {
-    use elastic_types::prelude::*;
-
-    #[derive(Default, Clone)]
-    pub struct MyGeoPointMapping;
-    impl GeoPointMapping for MyGeoPointMapping {
-        type Format = GeoPointArray;
-
-        fn geohash() -> Option<bool> {
-            Some(false)
-        }
-
-        fn geohash_precision() -> Option<Distance> {
-            Some(Distance(50.0, DistanceUnit::Meters))
-        }
-
-        fn geohash_prefix() -> Option<bool> {
-            Some(true)
-        }
-
-        fn ignore_malformed() -> Option<bool> {
-            Some(true)
-        }
-
-        fn lat_lon() -> Option<bool> {
-            Some(true)
-        }
-    }
-}
-
-pub mod geo_shape_fixtures {
-    use elastic_types::prelude::*;
-
-    #[derive(Default, Clone)]
-    pub struct MyGeoShapeMapping;
-    impl GeoShapeMapping for MyGeoShapeMapping {
-        fn tree() -> Option<Tree> {
-            Some(Tree::Geohash)
-        }
-
-        fn precision() -> Option<Distance> {
-            Some(Distance(50.0, DistanceUnit::Meters))
-        }
-
-        fn tree_levels() -> Option<i32> {
-            Some(8)
-        }
-
-        fn strategy() -> Option<Strategy> {
-            Some(Strategy::Recursive)
-        }
-
-        fn distance_error_pct() -> Option<f32> {
-            Some(0.5)
-        }
-
-        fn orientation() -> Option<Orientation> {
-            Some(Orientation::Clockwise)
-        }
-
-        fn points_only() -> Option<bool> {
-            Some(false)
-        }
-    }
-}
-
-pub mod object_fixtures {
-    use serde::ser::SerializeStruct;
-    use chrono::{DateTime, Utc};
-    use elastic_types::prelude::*;
-
-    #[derive(ElasticType)]
-    #[elastic(mapping = "MySmlMapping")]
-    pub struct MySmlType {
-        integer: i32,
-        string: String,
-        date: DateTime<Utc>,
-    }
-
-    #[derive(Default, Clone)]
-    pub struct MySmlMapping;
-    impl OpjectMapping for MySmlMapping {
-        fn name() -> &'static str {
-            "ty"
-        }
-    }
-
-    #[derive(ElasticType)]
-    #[elastic(mapping = "MyMedMapping")]
-    pub struct MyMedType {
-        integer: i32,
-        string: String,
-        date: DateTime<Utc>,
-        field: MySmlType,
-    }
-
-    #[derive(Default, Clone)]
-    pub struct MyMedMapping;
-    impl OpjectMapping for MyMedMapping {
-        fn name() -> &'static str {
-            "ty"
-        }
-    }
-
-    #[derive(ElasticType)]
-    #[elastic(mapping = "MyLrgMapping")]
-    pub struct MyLrgType {
-        integer: i32,
-        string: String,
-        date: DateTime<Utc>,
-        field: MyMedType,
-    }
-
-    #[derive(Default, Clone)]
-    pub struct MyLrgMapping;
-    impl OpjectMapping for MyLrgMapping {
-        fn name() -> &'static str {
-            "ty"
-        }
-    }
-}
-
-pub mod object;
-pub mod geo_point;
-pub mod geo_shape;
-pub mod date;
-pub mod string;
-pub mod number;
-pub mod boolean;
diff --git a/src/types/benches/number/mod.rs b/src/types/benches/number/mod.rs
deleted file mode 100644
index e31f253878..0000000000
--- a/src/types/benches/number/mod.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-use elastic_types;
-use elastic_types::prelude::*;
-use number_fixtures::*;
-
-use test::Bencher;
-
-#[bench]
-fn mapping(b: &mut Bencher) {
-    b.iter(|| {
-        elastic_types::derive::standalone_field_ser(MyIntegerMapping).unwrap()
-    });
-}
diff --git a/src/types/benches/object/mod.rs b/src/types/benches/object/mod.rs
deleted file mode 100644
index f081556a8c..0000000000
--- a/src/types/benches/object/mod.rs
+++ /dev/null
@@ -1,40 +0,0 @@
-use serde_json;
-use elastic_types::prelude::*;
-use object_fixtures::*;
-use test::Bencher;
-
-#[bench]
-fn mapping_sml(b: &mut Bencher) {
-    b.iter(|| {
-        serde_json::to_string(&MySmlType::index_mapping()).unwrap()
-    });
-}
-
-#[bench]
-fn mapping_med(b: &mut Bencher) {
-    b.iter(|| {
-        serde_json::to_string(&MyMedType::index_mapping()).unwrap()
-    });
-}
-
-#[bench]
-fn mapping_lrg(b: &mut Bencher) {
-    b.iter(|| {
-        serde_json::to_string(&MyLrgType::index_mapping()).unwrap()
-    });
-}
-
-#[bench]
-fn mapping_value_sml(b: &mut Bencher) {
-    b.iter(|| serde_json::to_value(&MySmlType::index_mapping()));
-}
-
-#[bench]
-fn mapping_value_med(b: &mut Bencher) {
-    b.iter(|| serde_json::to_value(&MyMedType::index_mapping()));
-}
-
-#[bench]
-fn mapping_value_lrg(b: &mut Bencher) {
-    b.iter(|| serde_json::to_value(&MyLrgType::index_mapping()));
-}
diff --git a/src/types/benches/string/mod.rs b/src/types/benches/string/mod.rs
deleted file mode 100644
index 279449e323..0000000000
--- a/src/types/benches/string/mod.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-use elastic_types;
-use elastic_types::prelude::*;
-use string_fixtures::*;
-
-use test::Bencher;
-
-#[bench]
-fn keyword_mapping(b: &mut Bencher) {
-    b.iter(|| {
-        elastic_types::derive::standalone_field_ser(MyKeywordMapping).unwrap()
-    });
-}
-
-#[bench]
-fn text_mapping(b: &mut Bencher) {
-    b.iter(|| {
-        elastic_types::derive::standalone_field_ser(MyTextMapping).unwrap()
-    });
-}
diff --git a/src/types/src/boolean/impls.rs b/src/types/src/boolean/impls.rs
index b85f1307da..62fbe02ec6 100644
--- a/src/types/src/boolean/impls.rs
+++ b/src/types/src/boolean/impls.rs
@@ -1,8 +1,20 @@
+use super::mapping::{
+    BooleanFieldType,
+    BooleanMapping,
+    DefaultBooleanMapping,
+};
+use serde::de::{
+    Error,
+    Visitor,
+};
+use serde::{
+    Deserialize,
+    Deserializer,
+    Serialize,
+    Serializer,
+};
 use std::borrow::Borrow;
 use std::marker::PhantomData;
-use serde::{Deserialize, Deserializer, Serialize, Serializer};
-use serde::de::{Error, Visitor};
-use super::mapping::{BooleanFieldType, BooleanMapping, DefaultBooleanMapping};
 
 impl BooleanFieldType<DefaultBooleanMapping> for bool {}
 
@@ -35,11 +47,11 @@ where
 {
     /**
     Creates a new `Boolean` with the given mapping.
-    
+
     # Examples
-    
+
     Create a new `Boolean` from a `bool`:
-    
+
     ```
     # use elastic_types::prelude::*;
     let boolean = Boolean::<DefaultBooleanMapping>::new(false);
@@ -57,11 +69,11 @@ where
 
     /**
     Change the mapping of this boolean.
-    
+
     # Examples
-    
+
     Change the mapping for a given `Boolean`:
-    
+
     ```
     # extern crate serde;
     # #[macro_use]
@@ -72,7 +84,7 @@ where
     # struct MyBooleanMapping;
     # impl BooleanMapping for MyBooleanMapping { }
     let boolean = Boolean::<DefaultBooleanMapping>::new(true);
-    
+
     let boolean: Boolean<MyBooleanMapping> = Boolean::remap(boolean);
     # }
     ```
@@ -85,11 +97,7 @@ where
     }
 }
 
-impl<TMapping> BooleanFieldType<TMapping> for Boolean<TMapping>
-where
-    TMapping: BooleanMapping,
-{
-}
+impl<TMapping> BooleanFieldType<TMapping> for Boolean<TMapping> where TMapping: BooleanMapping {}
 
 impl_mapping_type!(bool, Boolean, BooleanMapping);
 
diff --git a/src/types/src/boolean/mapping.rs b/src/types/src/boolean/mapping.rs
index 50bbe1f9a8..1d0a5c1a4e 100644
--- a/src/types/src/boolean/mapping.rs
+++ b/src/types/src/boolean/mapping.rs
@@ -106,10 +106,21 @@ pub struct DefaultBooleanMapping;
 impl BooleanMapping for DefaultBooleanMapping {}
 
 mod private {
-    use serde::{Serialize, Serializer};
+    use super::{
+        BooleanFieldType,
+        BooleanMapping,
+    };
+    use private::field::{
+        FieldMapping,
+        FieldType,
+        SerializeFieldMapping,
+        StaticSerialize,
+    };
     use serde::ser::SerializeStruct;
-    use private::field::{StaticSerialize, SerializeFieldMapping, FieldMapping, FieldType};
-    use super::{BooleanFieldType, BooleanMapping};
+    use serde::{
+        Serialize,
+        Serializer,
+    };
 
     #[derive(Default)]
     pub struct BooleanPivot;
diff --git a/src/types/src/boolean/mod.rs b/src/types/src/boolean/mod.rs
index f7461c5081..a7dbdbb6db 100644
--- a/src/types/src/boolean/mod.rs
+++ b/src/types/src/boolean/mod.rs
@@ -59,7 +59,7 @@ pub use self::impls::*;
 pub mod prelude {
     /*!
     Includes all types for the `boolean` type.
-    
+
     This is a convenience module to make it easy to build mappings for multiple types without too many `use` statements.
     */
 
diff --git a/src/types/src/date/format.rs b/src/types/src/date/format.rs
index eec837e408..e226dee1af 100644
--- a/src/types/src/date/format.rs
+++ b/src/types/src/date/format.rs
@@ -1,14 +1,27 @@
-use chrono::{self, NaiveDate, NaiveDateTime, NaiveTime, Utc};
-use chrono::format::{DelayedFormat, Item};
-use std::ops::Deref;
-use std::marker::PhantomData;
+use super::ChronoDateTime;
+use chrono::format::{
+    DelayedFormat,
+    Item,
+};
+use chrono::{
+    self,
+    NaiveDate,
+    NaiveDateTime,
+    NaiveTime,
+    Utc,
+};
 use std::borrow::Borrow;
 use std::error::Error;
-use std::fmt::{Display, Formatter, Result as FmtResult};
+use std::fmt::{
+    Display,
+    Formatter,
+    Result as FmtResult,
+};
+use std::marker::PhantomData;
+use std::ops::Deref;
 use std::vec::IntoIter;
-use super::ChronoDateTime;
 
-/** 
+/**
 A date value produced and consumed by date formats.
 
 `DateValue` is a very thin wrapper over `DateTime<Utc>` that doesn't carry any formatting semantics.
@@ -25,7 +38,15 @@ impl DateValue {
     }
 
     /** Construct a `DateValue` from individual parts. */
-    pub fn build(year: i32, month: u32, day: u32, hour: u32, minute: u32, second: u32, milli: u32) -> Self {
+    pub fn build(
+        year: i32,
+        month: u32,
+        day: u32,
+        hour: u32,
+        minute: u32,
+        second: u32,
+        milli: u32,
+    ) -> Self {
         let ndate = NaiveDate::from_ymd(year, month, day);
         let ntime = NaiveTime::from_hms_milli(hour, minute, second, milli);
 
@@ -81,7 +102,7 @@ impl Deref for DateValue {
     }
 }
 
-/** 
+/**
 A date value paired with a format.
 
 `FormattableDateValue<F>` bundles a `DateValue` with a specific format and is used to ensure the formats of mappable date types aren't accidentally changed.
@@ -195,7 +216,7 @@ pub trait DateFormat {
 
     /**
     The name of the format.
-    
+
     This is the string used when defining the format in the field mapping.
     */
     fn name() -> &'static str;
diff --git a/src/types/src/date/formats.rs b/src/types/src/date/formats.rs
index f99827e983..e3205db875 100644
--- a/src/types/src/date/formats.rs
+++ b/src/types/src/date/formats.rs
@@ -1,6 +1,16 @@
+use super::{
+    DateFormat,
+    DateValue,
+    FormattedDate,
+    ParseError,
+};
+use chrono::{
+    DateTime,
+    NaiveDateTime,
+    Timelike,
+    Utc,
+};
 use std::error::Error;
-use chrono::{DateTime, NaiveDateTime, Timelike, Utc};
-use super::{DateFormat, DateValue, FormattedDate, ParseError};
 
 /** The default `date` format (`BasicDateTime`). */
 pub type DefaultDateFormat = BasicDateTime;
@@ -17,7 +27,10 @@ Format for `basic_date_time_no_millis`.
 - [Elasticsearch Doc](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html#built-in-date-formats)
 */
 #[derive(ElasticDateFormat, PartialEq, Debug, Default, Clone, Copy)]
-#[elastic(date_format = "yyyyMMdd'T'HHmmssZ", date_format_name = "basic_date_time_no_millis")]
+#[elastic(
+    date_format = "yyyyMMdd'T'HHmmssZ",
+    date_format_name = "basic_date_time_no_millis"
+)]
 pub struct BasicDateTimeNoMillis;
 
 /**
@@ -27,7 +40,10 @@ Format for `basic_date_time`.
 - [Elasticsearch Doc](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html#built-in-date-formats)
 */
 #[derive(ElasticDateFormat, PartialEq, Debug, Default, Clone, Copy)]
-#[elastic(date_format = "yyyyMMdd'T'HHmmss.SSSZ", date_format_name = "basic_date_time")]
+#[elastic(
+    date_format = "yyyyMMdd'T'HHmmss.SSSZ",
+    date_format_name = "basic_date_time"
+)]
 pub struct BasicDateTime;
 
 /**
@@ -48,7 +64,8 @@ impl DateFormat for EpochMillis {
     }
 
     fn parse(date: &str) -> Result<DateValue, ParseError> {
-        let millis = date.parse::<i64>()
+        let millis = date
+            .parse::<i64>()
             .map_err(|e| e.description().to_string())?;
 
         let (s, m) = {
@@ -77,8 +94,15 @@ impl DateFormat for EpochMillis {
 
 #[cfg(test)]
 mod tests {
-    use chrono::{DateTime, Utc};
-    use date::{format, parse, ParseError};
+    use chrono::{
+        DateTime,
+        Utc,
+    };
+    use date::{
+        format,
+        parse,
+        ParseError,
+    };
     use prelude::*;
 
     #[test]
@@ -371,7 +395,8 @@ mod tests {
             }
         }
 
-        let date = parse::<DefaultDateMapping<MyCustomFormat>>("2015-07-03T14:55:02+00:00").unwrap();
+        let date =
+            parse::<DefaultDateMapping<MyCustomFormat>>("2015-07-03T14:55:02+00:00").unwrap();
 
         assert_eq!(
             (2015i32, 7u32, 3u32, 14u32, 55u32, 2u32),
diff --git a/src/types/src/date/impls.rs b/src/types/src/date/impls.rs
index 9b94846b24..a4530a8be1 100644
--- a/src/types/src/date/impls.rs
+++ b/src/types/src/date/impls.rs
@@ -1,16 +1,44 @@
-use std::borrow::Borrow;
-use std::ops::Deref;
-use std::marker::PhantomData;
-use std::fmt::{Display, Formatter, Result as FmtResult};
-use chrono::{DateTime, Utc};
-use serde::{Deserialize, Deserializer, Serialize, Serializer};
-use serde::de::{Error, Visitor};
-use super::format::{DateFormat, DateValue, FormattableDateValue, FormattedDate, ParseError};
+use super::format::{
+    DateFormat,
+    DateValue,
+    FormattableDateValue,
+    FormattedDate,
+    ParseError,
+};
 use super::formats::ChronoFormat;
-use super::mapping::{DateFieldType, DateMapping, DefaultDateMapping};
+use super::mapping::{
+    DateFieldType,
+    DateMapping,
+    DefaultDateMapping,
+};
+use chrono::{
+    DateTime,
+    Utc,
+};
 use private::field::StdField;
+use serde::de::{
+    Error,
+    Visitor,
+};
+use serde::{
+    Deserialize,
+    Deserializer,
+    Serialize,
+    Serializer,
+};
+use std::borrow::Borrow;
+use std::fmt::{
+    Display,
+    Formatter,
+    Result as FmtResult,
+};
+use std::marker::PhantomData;
+use std::ops::Deref;
 
-pub use chrono::{Datelike, Timelike};
+pub use chrono::{
+    Datelike,
+    Timelike,
+};
 
 /** A re-export of the `chrono::DateTime` struct with `Utc` timezone. */
 pub type ChronoDateTime = DateTime<Utc>;
@@ -81,9 +109,9 @@ where
 {
     /**
     Creates a new `Date` from the given `chrono::DateTime<Utc>`.
-    
+
     This function will consume the provided `chrono` date.
-    
+
     # Examples
 
     Create a `Date` from a `DateValue`:
@@ -92,11 +120,11 @@ where
     # use elastic_types::prelude::*;
     //Create a DateValue struct
     let date = DateValue::now();
-    
+
     //Give it to the Date struct
     let date: Date<DefaultDateMapping> = Date::new(date);
     ```
-    
+
     If the `Date`s format is `ChronoFormat`, then it can also be created from `chrono::DateTime`:
 
     ```
@@ -105,10 +133,10 @@ where
     # extern crate chrono;
     # fn main() {
     use chrono::Utc;
-    
+
     //Create a chrono DateTime struct
     let chronoDate = Utc::now();
-    
+
     //Give it to the Date struct
     let date: Date<DefaultDateMapping<ChronoFormat>> = Date::new(chronoDate);
     # }
@@ -116,17 +144,17 @@ where
 
     If the `Date`s format isn't `ChronoFormat`, then the `chrono::DateTime` will need to be converted into a `DateValue` first.
     This is to make sure you don't accidentally change the format of a date, which could lead to errors at runtime:
-    
+
     ```
     # extern crate elastic_types;
     # use elastic_types::prelude::*;
     # extern crate chrono;
     # fn main() {
     use chrono::Utc;
-    
+
     //Create a chrono DateTime struct
     let chronoDate = Utc::now();
-    
+
     //Give it to the Date struct
     let date: Date<DefaultDateMapping<EpochMillis>> = Date::new(DateValue::from(chronoDate));
     # }
@@ -141,29 +169,31 @@ where
 
     /**
     Creates an `Date` from the given Utc primitives:
-    
+
     ```
     # use elastic_types::prelude::*;
     let date: Date<DefaultDateMapping> = Date::build(2015, 5, 14, 16, 45, 8, 886);
     ```
     */
-    pub fn build(year: i32, month: u32, day: u32, hour: u32, minute: u32, second: u32, milli: u32) -> Self {
+    pub fn build(
+        year: i32,
+        month: u32,
+        day: u32,
+        hour: u32,
+        minute: u32,
+        second: u32,
+        milli: u32,
+    ) -> Self {
         Date::new(DateValue::build(
-            year,
-            month,
-            day,
-            hour,
-            minute,
-            second,
-            milli,
+            year, month, day, hour, minute, second, milli,
         ))
     }
 
     /**
     Gets the current system time.
-    
+
     # Examples
-    
+
     ```
     # use elastic_types::prelude::*;
     let date: Date<DefaultDateMapping> = Date::now();
@@ -175,14 +205,14 @@ where
 
     /**
     Change the format/mapping of this date.
-    
+
     # Examples
-    
+
     ```
     # use elastic_types::prelude::*;
     //Get the current datetime formatted as basic_date_time
     let date: Date<DefaultDateMapping<BasicDateTime>> = Date::now();
-    
+
     //Change the format to epoch_millis
     let otherdate: Date<DefaultDateMapping<EpochMillis>> = Date::remap(date);
     ```
@@ -195,11 +225,7 @@ where
     }
 }
 
-impl<TMapping> DateFieldType<TMapping> for Date<TMapping>
-where
-    TMapping: DateMapping,
-{
-}
+impl<TMapping> DateFieldType<TMapping> for Date<TMapping> where TMapping: DateMapping {}
 
 impl<TMapping> From<Date<TMapping>> for FormattableDateValue<TMapping::Format>
 where
@@ -237,11 +263,7 @@ where
     }
 }
 
-impl<TMapping> StdField<ChronoDateTime> for Date<TMapping>
-where
-    TMapping: DateMapping,
-{
-}
+impl<TMapping> StdField<ChronoDateTime> for Date<TMapping> where TMapping: DateMapping {}
 
 impl<TMapping> PartialEq<ChronoDateTime> for Date<TMapping>
 where
@@ -553,7 +575,7 @@ where
 {
     /**
     Create a new date expression for `now`.
-    
+
     This value is different from `Date::now()` because it doesn't calculate the current date from the system clock.
     It serialises to the literal string `"now"`, which is interpreted by Elasticsearch when indexing.
     */
@@ -564,7 +586,7 @@ where
         }
     }
 
-    /** 
+    /**
     Create a new date expression from a concrete date value.
 
     If the input is a `DateValue`, then it'll use any format specified on the `DateExpr`.
@@ -658,9 +680,9 @@ where
 
 #[cfg(test)]
 mod tests {
-    use serde_json;
     use chrono;
     use chrono::offset::TimeZone;
+    use serde_json;
 
     use prelude::*;
 
@@ -770,7 +792,9 @@ mod tests {
 
     #[test]
     fn serialise_elastic_date() {
-        let date = Date::<DefaultDateMapping<BasicDateTime>>::new(DateValue::build(2015, 05, 13, 0, 0, 0, 0));
+        let date = Date::<DefaultDateMapping<BasicDateTime>>::new(DateValue::build(
+            2015, 05, 13, 0, 0, 0, 0,
+        ));
 
         let ser = serde_json::to_string(&date).unwrap();
 
@@ -779,7 +803,8 @@ mod tests {
 
     #[test]
     fn deserialise_elastic_date() {
-        let date: Date<DefaultDateMapping<BasicDateTime>> = serde_json::from_str(r#""20150513T000000.000Z""#).unwrap();
+        let date: Date<DefaultDateMapping<BasicDateTime>> =
+            serde_json::from_str(r#""20150513T000000.000Z""#).unwrap();
 
         assert_eq!((2015, 5, 13), (date.year(), date.month(), date.day()));
     }
@@ -809,13 +834,7 @@ mod tests {
     #[test]
     fn serialise_date_expr_date() {
         let expr = DateExpr::value(Date::<DefaultDateMapping<BasicDateTime>>::build(
-            2015,
-            5,
-            13,
-            0,
-            0,
-            0,
-            0,
+            2015, 5, 13, 0, 0, 0, 0,
         ));
 
         let ser = serde_json::to_string(&expr).unwrap();
@@ -826,15 +845,10 @@ mod tests {
     #[test]
     fn serialise_date_expr_value_with_ops() {
         let expr = DateExpr::value(Date::<DefaultDateMapping<BasicDateTime>>::build(
-            2015,
-            5,
-            13,
-            0,
-            0,
-            0,
-            0,
-        )).add_days(2)
-            .round_week();
+            2015, 5, 13, 0, 0, 0, 0,
+        ))
+        .add_days(2)
+        .round_week();
 
         let ser = serde_json::to_string(&expr).unwrap();
 
diff --git a/src/types/src/date/mapping.rs b/src/types/src/date/mapping.rs
index 3b1fe0977b..aea79d48cc 100644
--- a/src/types/src/date/mapping.rs
+++ b/src/types/src/date/mapping.rs
@@ -1,7 +1,12 @@
 /*! Mapping for the Elasticsearch `date` type. */
 
+use super::{
+    Date,
+    DateFormat,
+    DefaultDateFormat,
+    FormattableDateValue,
+};
 use std::marker::PhantomData;
-use super::{Date, DateFormat, DefaultDateFormat, FormattableDateValue};
 
 /** A field that will be mapped as a `date`. */
 pub trait DateFieldType<TMapping>
@@ -86,7 +91,7 @@ struct MyDateMapping<F> {
     _marker: PhantomData<F>
 }
 
-impl <F> DateMapping for MyDateMapping<F> 
+impl <F> DateMapping for MyDateMapping<F>
     where F: DateFormat
 {
     type Format = F;
@@ -179,11 +184,25 @@ where
 }
 
 mod private {
-    use serde::{Serialize, Serializer};
+    use super::{
+        DateFieldType,
+        DateMapping,
+    };
+    use date::{
+        DateFormat,
+        FormattableDateValue,
+    };
+    use private::field::{
+        FieldMapping,
+        FieldType,
+        SerializeFieldMapping,
+        StaticSerialize,
+    };
     use serde::ser::SerializeStruct;
-    use date::{DateFormat, FormattableDateValue};
-    use private::field::{StaticSerialize, SerializeFieldMapping, FieldMapping, FieldType};
-    use super::{DateFieldType, DateMapping};
+    use serde::{
+        Serialize,
+        Serializer,
+    };
 
     impl<TField, TMapping> FieldType<TMapping, DatePivot> for TField
     where
@@ -278,10 +297,10 @@ mod tests {
 
     #[test]
     fn serialise_mapping_default() {
-        let ser = serde_json::to_string(&field::serialize(DefaultDateMapping::<
-            DefaultDateFormat,
-        >::default()))
-            .unwrap();
+        let ser = serde_json::to_string(&field::serialize(
+            DefaultDateMapping::<DefaultDateFormat>::default(),
+        ))
+        .unwrap();
 
         let expected = json_str!({
             "type": "date",
diff --git a/src/types/src/date/mod.rs b/src/types/src/date/mod.rs
index 1f64cf67c4..21deba622c 100644
--- a/src/types/src/date/mod.rs
+++ b/src/types/src/date/mod.rs
@@ -125,19 +125,24 @@ mod format;
 mod formats;
 mod impls;
 pub use self::format::*;
-pub use self::impls::*;
 pub use self::formats::*;
+pub use self::impls::*;
 
 pub mod prelude {
     /*!
     Includes all types for the `date` type.
-    
+
     This is a convenience module to make it easy to build mappings for multiple types without too many `use` statements.
     */
 
-    pub use super::DefaultDateFormat;
-    pub use super::format::{DateFormat, DateValue, FormattableDateValue, FormattedDate};
-    pub use super::impls::*;
+    pub use super::format::{
+        DateFormat,
+        DateValue,
+        FormattableDateValue,
+        FormattedDate,
+    };
     pub use super::formats::*;
+    pub use super::impls::*;
     pub use super::mapping::*;
+    pub use super::DefaultDateFormat;
 }
diff --git a/src/types/src/derive.rs b/src/types/src/derive.rs
index 0ea2fbd13c..06b38fd3b6 100644
--- a/src/types/src/derive.rs
+++ b/src/types/src/derive.rs
@@ -5,23 +5,54 @@ This module is 'private' and should only be consumed by `elastic_types_derive`.
 Its contents aren't subject to SemVer.
 */
 
-use serde_json;
+use chrono::format::{
+    self,
+    Parsed,
+};
+use chrono::{
+    DateTime,
+    Utc,
+};
 use serde::Serialize;
-use chrono::{DateTime, Utc};
-use chrono::format::{self, Parsed};
+use serde_json;
 
-use private::field::{SerializeFieldMapping, FieldMapping, FieldType};
+use private::field::{
+    FieldMapping,
+    FieldType,
+    SerializeFieldMapping,
+};
 
-pub use date::{DateFormat, DateValue, FormattedDate, ParseError};
-pub use document::{DocumentType, StaticIndex, StaticType};
-pub use document::mapping::{ObjectMapping, ObjectFieldType, PropertiesMapping};
+pub use date::{
+    DateFormat,
+    DateValue,
+    FormattedDate,
+    ParseError,
+};
+pub use document::mapping::{
+    ObjectFieldType,
+    ObjectMapping,
+    PropertiesMapping,
+};
+pub use document::{
+    DocumentType,
+    StaticIndex,
+    StaticType,
+};
 
-pub use chrono::format::{Fixed, Item, Numeric, Pad};
+pub use chrono::format::{
+    Fixed,
+    Item,
+    Numeric,
+    Pad,
+};
 pub use serde::ser::SerializeStruct;
 
 /** Serialise a field mapping as a field using the given serialiser. */
 #[inline]
-pub fn field_ser<TField, TMapping, TPivot, S>(state: &mut S, field: &'static str) -> Result<(), S::Error>
+pub fn field_ser<TField, TMapping, TPivot, S>(
+    state: &mut S,
+    field: &'static str,
+) -> Result<(), S::Error>
 where
     TField: FieldType<TMapping, TPivot>,
     TMapping: FieldMapping<TPivot>,
diff --git a/src/types/src/document/impls.rs b/src/types/src/document/impls.rs
index bbc80e5c92..fa24c05054 100644
--- a/src/types/src/document/impls.rs
+++ b/src/types/src/document/impls.rs
@@ -1,8 +1,12 @@
-use std::borrow::Cow;
-use std::marker::PhantomData;
+use super::mapping::{
+    ObjectFieldType,
+    ObjectMapping,
+    PropertiesMapping,
+};
 use serde::ser::SerializeStruct;
 use serde_json::Value;
-use super::mapping::{ObjectFieldType, ObjectMapping, PropertiesMapping};
+use std::borrow::Cow;
+use std::marker::PhantomData;
 
 /**
 An indexable Elasticsearch type.
@@ -56,7 +60,7 @@ pub trait StaticType: DocumentType {
 }
 
 /**
-A wrapper type for serialising user types as fields. 
+A wrapper type for serialising user types as fields.
 */
 #[derive(Clone, Copy)]
 pub struct FieldDocumentMapping<TMapping>(PhantomData<TMapping>);
@@ -268,7 +272,7 @@ where
 {
     fn default() -> Self {
         IndexDocumentMapping {
-            _m: Default::default()
+            _m: Default::default(),
         }
     }
 }
@@ -406,10 +410,18 @@ where
 
 #[cfg(test)]
 mod tests {
-    use std::borrow::Cow;
-    use serde_json::{self, Value};
+    use super::{
+        DocumentType,
+        IndexDocumentMapping,
+        StaticIndex,
+        StaticType,
+    };
     use prelude::*;
-    use super::{DocumentType, StaticIndex, StaticType, IndexDocumentMapping};
+    use serde_json::{
+        self,
+        Value,
+    };
+    use std::borrow::Cow;
 
     // Make sure we can derive with no `uses`.
     pub mod no_prelude {
@@ -454,11 +466,14 @@ mod tests {
         index = "renamed_index",
         ty = "renamed_ty",
         id(expr = "CustomType::id"),
-        mapping = "ManualCustomTypeMapping")]
+        mapping = "ManualCustomTypeMapping"
+    )]
     pub struct CustomType {
         pub field: i32,
-        #[serde(skip_serializing)] pub ignored_field: i32,
-        #[serde(rename = "renamed_field")] pub field2: i32,
+        #[serde(skip_serializing)]
+        pub ignored_field: i32,
+        #[serde(rename = "renamed_field")]
+        pub field2: i32,
     }
 
     impl CustomType {
@@ -541,7 +556,10 @@ mod tests {
 
     #[test]
     fn derive_custom_type_mapping() {
-        assert_eq!(ManualCustomTypeMapping, CustomType::field_mapping().into_mapping());
+        assert_eq!(
+            ManualCustomTypeMapping,
+            CustomType::field_mapping().into_mapping()
+        );
     }
 
     #[test]
diff --git a/src/types/src/document/mapping.rs b/src/types/src/document/mapping.rs
index 930777e925..f8e229c158 100644
--- a/src/types/src/document/mapping.rs
+++ b/src/types/src/document/mapping.rs
@@ -1,7 +1,10 @@
 /*! Mapping for Elasticsearch document types. */
 
-use serde::{Serialize, Serializer};
 use serde::ser::SerializeStruct;
+use serde::{
+    Serialize,
+    Serializer,
+};
 
 /** A field that will be mapped as a nested document. */
 pub trait ObjectFieldType {
@@ -81,9 +84,12 @@ Inner objects inherit the setting from their parent object or from the mapping t
 */
 #[derive(Debug, Clone, Copy)]
 pub enum Dynamic {
-    /** Newly detected fields are added to the mapping. (default). */ True,
-    /** Newly detected fields are ignored. New fields must be added explicitly. */ False,
-    /** If new fields are detected, an exception is thrown and the document is rejected. */ Strict,
+    /** Newly detected fields are added to the mapping. (default). */
+    True,
+    /** Newly detected fields are ignored. New fields must be added explicitly. */
+    False,
+    /** If new fields are detected, an exception is thrown and the document is rejected. */
+    Strict,
 }
 
 impl Serialize for Dynamic {
@@ -100,12 +106,28 @@ impl Serialize for Dynamic {
 }
 
 mod private {
-    use std::marker::PhantomData;
-    use serde::{Serialize, Serializer};
+    use super::{
+        ObjectFieldType,
+        ObjectMapping,
+        PropertiesMapping,
+        OBJECT_DATATYPE,
+    };
+    use document::{
+        FieldDocumentMapping,
+        IndexDocumentMapping,
+    };
+    use private::field::{
+        FieldMapping,
+        FieldType,
+        SerializeFieldMapping,
+        StaticSerialize,
+    };
     use serde::ser::SerializeStruct;
-    use document::{FieldDocumentMapping, IndexDocumentMapping};
-    use private::field::{StaticSerialize, SerializeFieldMapping, FieldMapping, FieldType};
-    use super::{ObjectFieldType, ObjectMapping, PropertiesMapping, OBJECT_DATATYPE};
+    use serde::{
+        Serialize,
+        Serializer,
+    };
+    use std::marker::PhantomData;
 
     #[derive(Default)]
     pub struct ObjectPivot;
@@ -143,7 +165,8 @@ mod private {
         where
             S: Serializer,
         {
-            let mut state = try!(serializer.serialize_struct("properties", TMapping::Properties::props_len()));
+            let mut state =
+                try!(serializer.serialize_struct("properties", TMapping::Properties::props_len()));
             try!(TMapping::Properties::serialize_props(&mut state));
             state.end()
         }
@@ -180,7 +203,8 @@ mod private {
             }
 
             if has_props {
-                try!(state.serialize_field("properties", &Properties::<TMapping> { _m: PhantomData }));
+                try!(state
+                    .serialize_field("properties", &Properties::<TMapping> { _m: PhantomData }));
             }
 
             state.end()
diff --git a/src/types/src/document/mod.rs b/src/types/src/document/mod.rs
index ad7c9fda29..7bb0261311 100644
--- a/src/types/src/document/mod.rs
+++ b/src/types/src/document/mod.rs
@@ -375,7 +375,7 @@ pub use self::impls::*;
 pub mod prelude {
     /*!
     Includes all types for document types.
-    
+
     This is a convenience module to make it easy to build mappings for multiple types without too many `use` statements.
     */
 
diff --git a/src/types/src/geo/mapping.rs b/src/types/src/geo/mapping.rs
index 450088ab70..ea21858447 100644
--- a/src/types/src/geo/mapping.rs
+++ b/src/types/src/geo/mapping.rs
@@ -5,13 +5,20 @@ use serde::Serialize;
 
 /** A unit of measure for distance. */
 pub enum DistanceUnit {
-    /** For `in`. */ Inches,
-    /** For `yd`. */ Yards,
-    /** For `mi`. */ Miles,
-    /** For `km`. */ Kilometers,
-    /** For `m`. */ Meters,
-    /** For `cm`. */ Centimeters,
-    /** For `mm`. */ Millimeters,
+    /** For `in`. */
+    Inches,
+    /** For `yd`. */
+    Yards,
+    /** For `mi`. */
+    Miles,
+    /** For `km`. */
+    Kilometers,
+    /** For `m`. */
+    Meters,
+    /** For `cm`. */
+    Centimeters,
+    /** For `mm`. */
+    Millimeters,
 }
 
 /** A distance value paired with a unit of measure. */
diff --git a/src/types/src/geo/mod.rs b/src/types/src/geo/mod.rs
index 869071e15f..2ba2f00c5a 100644
--- a/src/types/src/geo/mod.rs
+++ b/src/types/src/geo/mod.rs
@@ -13,11 +13,11 @@ pub mod shape;
 pub mod prelude {
     /*!
     Includes all types for the `geo_point` and `geo_shape` types.
-    
+
     This is a convenience module to make it easy to build mappings for multiple types without too many `use` statements.
     */
 
+    pub use super::mapping::*;
     pub use super::point::prelude::*;
     pub use super::shape::prelude::*;
-    pub use super::mapping::*;
 }
diff --git a/src/types/src/geo/point/format.rs b/src/types/src/geo/point/format.rs
index 63bff42ae1..99540cdd2f 100644
--- a/src/types/src/geo/point/format.rs
+++ b/src/types/src/geo/point/format.rs
@@ -1,12 +1,15 @@
-use serde::{Deserializer, Serializer};
-use super::Point;
 use super::mapping::GeoPointMapping;
+use super::Point;
+use serde::{
+    Deserializer,
+    Serializer,
+};
 
 /** A format used for parsing and formatting geo points. */
 pub trait GeoPointFormat {
     /**
     Parses a `geo::Point`.
-    
+
     This requires access to the full `serde` deserializer because geo points can be serialised as
     different kinds of complex objects.
     */
@@ -16,10 +19,10 @@ pub trait GeoPointFormat {
 
     /**
     Formats a `geo::Point`.
-    
+
     This requires access to the full `serde` serializer because geo points can be serialised as
     different kinds of complex objects.
-    
+
     Formatting also has access to the mapping type, which could be needed to build the structure
     properly.
     */
diff --git a/src/types/src/geo/point/formats.rs b/src/types/src/geo/point/formats.rs
index 2b9ab47ec3..cc72441a5d 100644
--- a/src/types/src/geo/point/formats.rs
+++ b/src/types/src/geo/point/formats.rs
@@ -1,11 +1,25 @@
-use std::str::FromStr;
-use std::fmt::Write;
-use serde::{Deserialize, Deserializer, Serialize, Serializer};
-use serde::de::{Error, SeqAccess, Unexpected, Visitor};
-use geohash;
-use super::{Coordinate, GeoPointFormat, Point};
 use super::mapping::GeoPointMapping;
+use super::{
+    Coordinate,
+    GeoPointFormat,
+    Point,
+};
 use geo::mapping::Distance;
+use geohash;
+use serde::de::{
+    Error,
+    SeqAccess,
+    Unexpected,
+    Visitor,
+};
+use serde::{
+    Deserialize,
+    Deserializer,
+    Serialize,
+    Serializer,
+};
+use std::fmt::Write;
+use std::str::FromStr;
 
 /** The default `geo_point` format (`GeoPointArray`). */
 pub type DefaultGeoPointFormat = GeoPointArray;
@@ -38,7 +52,8 @@ impl GeoPointFormat for GeoPointObject {
         GeoPointObjectType {
             lon: point.x(),
             lat: point.y(),
-        }.serialize(serializer)
+        }
+        .serialize(serializer)
     }
 }
 
@@ -161,7 +176,8 @@ impl GeoPointFormat for GeoPointHash {
                 y: point.y(),
             },
             len,
-        ).serialize(serializer)
+        )
+        .serialize(serializer)
     }
 }
 
@@ -229,7 +245,8 @@ mod tests {
 
     #[test]
     fn object() {
-        let point: GeoPoint<DefaultGeoPointMapping<GeoPointObject>> = serde_json::from_str(r#"{"lat":41.0,"lon":-71.34}"#).unwrap();
+        let point: GeoPoint<DefaultGeoPointMapping<GeoPointObject>> =
+            serde_json::from_str(r#"{"lat":41.0,"lon":-71.34}"#).unwrap();
 
         assert_eq!((-71.34, 41.0), (point.x(), point.y()));
 
@@ -240,7 +257,8 @@ mod tests {
 
     #[test]
     fn string() {
-        let point: GeoPoint<DefaultGeoPointMapping<GeoPointString>> = serde_json::from_str(r#""41.12,-71.34""#).unwrap();
+        let point: GeoPoint<DefaultGeoPointMapping<GeoPointString>> =
+            serde_json::from_str(r#""41.12,-71.34""#).unwrap();
 
         assert_eq!((-71.34, 41.12), (point.x(), point.y()));
 
@@ -251,21 +269,25 @@ mod tests {
 
     #[test]
     fn string_with_single_point() {
-        let de = serde_json::from_str::<GeoPoint<DefaultGeoPointMapping<GeoPointString>>>(r#""41.12""#);
+        let de =
+            serde_json::from_str::<GeoPoint<DefaultGeoPointMapping<GeoPointString>>>(r#""41.12""#);
 
         assert!(de.is_err());
     }
 
     #[test]
     fn string_with_invalid_nums() {
-        let de = serde_json::from_str::<GeoPoint<DefaultGeoPointMapping<GeoPointString>>>(r#""41.12,stuff""#);
+        let de = serde_json::from_str::<GeoPoint<DefaultGeoPointMapping<GeoPointString>>>(
+            r#""41.12,stuff""#,
+        );
 
         assert!(de.is_err());
     }
 
     #[test]
     fn hash() {
-        let point: GeoPoint<DefaultGeoPointMapping<GeoPointHash>> = serde_json::from_str(r#""drm3btev3e86""#).unwrap();
+        let point: GeoPoint<DefaultGeoPointMapping<GeoPointHash>> =
+            serde_json::from_str(r#""drm3btev3e86""#).unwrap();
 
         assert_eq!(
             (-71.34000012651086, 41.12000000663102),
@@ -279,7 +301,8 @@ mod tests {
 
     #[test]
     fn array() {
-        let point: GeoPoint<DefaultGeoPointMapping<GeoPointArray>> = serde_json::from_str(r#"[-71.34,41]"#).unwrap();
+        let point: GeoPoint<DefaultGeoPointMapping<GeoPointArray>> =
+            serde_json::from_str(r#"[-71.34,41]"#).unwrap();
 
         assert_eq!((-71.34, 41.0), (point.x(), point.y()));
 
@@ -290,7 +313,8 @@ mod tests {
 
     #[test]
     fn array_with_single_point() {
-        let de = serde_json::from_str::<GeoPoint<DefaultGeoPointMapping<GeoPointArray>>>(r#"[-71.34]"#);
+        let de =
+            serde_json::from_str::<GeoPoint<DefaultGeoPointMapping<GeoPointArray>>>(r#"[-71.34]"#);
 
         assert!(de.is_err());
     }
diff --git a/src/types/src/geo/point/impls.rs b/src/types/src/geo/point/impls.rs
index 407cf7aaf5..5cc7223d3c 100644
--- a/src/types/src/geo/point/impls.rs
+++ b/src/types/src/geo/point/impls.rs
@@ -1,9 +1,25 @@
+use super::mapping::{
+    GeoPointFieldType,
+    GeoPointMapping,
+};
+use super::{
+    Coordinate,
+    GeoPointFormat,
+    Geometry,
+    Point,
+};
+use georust::{
+    Geometry as GeoEnum,
+    ToGeo,
+};
+use serde::{
+    Deserialize,
+    Deserializer,
+    Serialize,
+    Serializer,
+};
 use std::borrow::Borrow;
 use std::marker::PhantomData;
-use serde::{Deserialize, Deserializer, Serialize, Serializer};
-use georust::{Geometry as GeoEnum, ToGeo};
-use super::mapping::{GeoPointFieldType, GeoPointMapping};
-use super::{Coordinate, GeoPointFormat, Geometry, Point};
 
 /**
 An Elasticsearch `geo_point` type with a format.
@@ -58,21 +74,21 @@ where
 {
     /**
     Creates a new `GeoPoint` from the given coordinate.
-    
+
     This function will consume the provided `Coordinate`.
-    
+
     # Examples
-    
+
     ```
     # extern crate elastic_types;
     # extern crate geo;
     # fn main() {
     use geo::{ Point, Coordinate };
     use elastic_types::prelude::*;
-    
+
     //Create a geo Coordinate struct
     let coord = Coordinate { x: 1.0, y: 1.0 };
-    
+
     //Give it to the GeoPoint struct
     let point: GeoPoint<DefaultGeoPointMapping> = GeoPoint::new(Point(coord));
     # }
@@ -90,7 +106,7 @@ where
 
     /**
     Creates an `GeoPoint` from the given `x` and `y` primitives:
-    
+
     ```
     # use elastic_types::prelude::*;
     let point: GeoPoint<DefaultGeoPointMapping> = GeoPoint::build(1.0, 1.0);
@@ -102,14 +118,14 @@ where
 
     /**
     Change the format/mapping of this geo point.
-    
+
     # Examples
-    
+
     ```
     # use elastic_types::prelude::*;
     //Get a point formatted as a string
     let point: GeoPoint<DefaultGeoPointMapping<GeoPointString>> = GeoPoint::build(1.0, 1.0);
-    
+
     //Change the format to an object
     let otherpoint: GeoPoint<DefaultGeoPointMapping<GeoPointObject>> = GeoPoint::remap(point);
     ```
@@ -122,11 +138,7 @@ where
     }
 }
 
-impl<TMapping> GeoPointFieldType<TMapping> for GeoPoint<TMapping>
-where
-    TMapping: GeoPointMapping,
-{
-}
+impl<TMapping> GeoPointFieldType<TMapping> for GeoPoint<TMapping> where TMapping: GeoPointMapping {}
 
 impl_mapping_type!(Point, GeoPoint, GeoPointMapping);
 
@@ -176,7 +188,12 @@ where
 
 #[cfg(test)]
 mod tests {
-    use georust::{Coordinate, Geometry, Point, ToGeo};
+    use georust::{
+        Coordinate,
+        Geometry,
+        Point,
+        ToGeo,
+    };
 
     use prelude::*;
 
@@ -186,7 +203,8 @@ mod tests {
             true
         }
 
-        let point: GeoPoint<DefaultGeoPointMapping<GeoPointString>> = GeoPoint::new(Point(Coordinate { x: 1.0, y: 1.0 }));
+        let point: GeoPoint<DefaultGeoPointMapping<GeoPointString>> =
+            GeoPoint::new(Point(Coordinate { x: 1.0, y: 1.0 }));
 
         assert!(takes_custom_mapping(GeoPoint::remap(point)));
     }
@@ -195,14 +213,19 @@ mod tests {
     fn can_build_point_from_geo() {
         let coord = Coordinate { x: 1.0, y: 1.0 };
 
-        let point = GeoPoint::<DefaultGeoPointMapping<DefaultGeoPointFormat>>::new(Point(coord.clone()));
+        let point =
+            GeoPoint::<DefaultGeoPointMapping<DefaultGeoPointFormat>>::new(Point(coord.clone()));
 
         assert_eq!((coord.x, coord.y), (point.x(), point.y()));
     }
 
     #[test]
     fn can_convert_point_to_geo() {
-        let point = GeoPoint::<DefaultGeoPointMapping<DefaultGeoPointFormat>>::new(Point(Coordinate { x: 1.0, y: 1.0 }));
+        let point =
+            GeoPoint::<DefaultGeoPointMapping<DefaultGeoPointFormat>>::new(Point(Coordinate {
+                x: 1.0,
+                y: 1.0,
+            }));
         let geo = point.to_geo();
 
         match geo {
diff --git a/src/types/src/geo/point/mapping.rs b/src/types/src/geo/point/mapping.rs
index 273b43f41b..b8d522a584 100644
--- a/src/types/src/geo/point/mapping.rs
+++ b/src/types/src/geo/point/mapping.rs
@@ -1,8 +1,11 @@
 /*! Mapping for the Elasticsearch `geo_point` type. */
 
-use std::marker::PhantomData;
-use super::{DefaultGeoPointFormat, GeoPointFormat};
+use super::{
+    DefaultGeoPointFormat,
+    GeoPointFormat,
+};
 use geo::mapping::Distance;
+use std::marker::PhantomData;
 
 /** A field that will be mapped as a `geo_point`. */
 pub trait GeoPointFieldType<M> {}
@@ -149,10 +152,21 @@ where
 }
 
 mod private {
-    use serde::{Serialize, Serializer};
+    use super::{
+        GeoPointFieldType,
+        GeoPointMapping,
+    };
+    use private::field::{
+        FieldMapping,
+        FieldType,
+        SerializeFieldMapping,
+        StaticSerialize,
+    };
     use serde::ser::SerializeStruct;
-    use private::field::{StaticSerialize, SerializeFieldMapping, FieldMapping, FieldType};
-    use super::{GeoPointFieldType, GeoPointMapping};
+    use serde::{
+        Serialize,
+        Serializer,
+    };
 
     #[derive(Default)]
     pub struct GeoPointPivot;
@@ -236,7 +250,7 @@ mod tests {
         let ser = serde_json::to_string(&field::serialize(DefaultGeoPointMapping::<
             DefaultGeoPointFormat,
         >::default()))
-            .unwrap();
+        .unwrap();
 
         let expected = json_str!({
             "type": "geo_point"
diff --git a/src/types/src/geo/point/mod.rs b/src/types/src/geo/point/mod.rs
index 3aef554c75..5f31591c55 100644
--- a/src/types/src/geo/point/mod.rs
+++ b/src/types/src/geo/point/mod.rs
@@ -61,7 +61,11 @@ impl GeoPointFieldType<DefaultGeoPointMapping<GeoPointObject>> for MyGeoPointFie
 - [Elasticsearch Doc](https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html)
 */
 
-use georust::{Coordinate as C, Geometry as G, Point as P};
+use georust::{
+    Coordinate as C,
+    Geometry as G,
+    Point as P,
+};
 
 type Coordinate = C<f64>;
 type Point = P<f64>;
@@ -69,24 +73,24 @@ type Geometry = G<f64>;
 
 pub mod mapping;
 
-mod impls;
 mod format;
 mod formats;
+mod impls;
 
-pub use self::impls::*;
 pub use self::format::*;
 pub use self::formats::*;
+pub use self::impls::*;
 
 pub mod prelude {
     /*!
     Includes all types for the `geo_point` type.
-    
+
     This is a convenience module to make it easy to build mappings for multiple types without too many `use` statements.
     */
 
-    pub use super::DefaultGeoPointFormat;
     pub use super::format::*;
-    pub use super::impls::*;
     pub use super::formats::*;
+    pub use super::impls::*;
     pub use super::mapping::*;
+    pub use super::DefaultGeoPointFormat;
 }
diff --git a/src/types/src/geo/shape/impls.rs b/src/types/src/geo/shape/impls.rs
index 8fec986077..45cd9beceb 100644
--- a/src/types/src/geo/shape/impls.rs
+++ b/src/types/src/geo/shape/impls.rs
@@ -1,8 +1,16 @@
+use super::mapping::{
+    GeoShapeFieldType,
+    GeoShapeMapping,
+};
+use geojson::Geometry;
+use serde::{
+    Deserialize,
+    Deserializer,
+    Serialize,
+    Serializer,
+};
 use std::borrow::Borrow;
 use std::marker::PhantomData;
-use serde::{Deserialize, Deserializer, Serialize, Serializer};
-use geojson::Geometry;
-use super::mapping::{GeoShapeFieldType, GeoShapeMapping};
 
 /**
 Geo shape type with a given mapping.
@@ -39,16 +47,16 @@ where
 {
     /**
     Creates a new `GeoShape` from the given `Geometry`.
-    
+
     This function will consume the provided `Geometry`.
-    
+
     # Examples
-    
+
     ```
     # extern crate elastic_types;
     # extern crate geojson;
     use geojson::{ Geometry, Value };
-    
+
     # use elastic_types::prelude::*;
     # fn main() {
     let point: GeoShape<DefaultGeoShapeMapping> = GeoShape::new(
@@ -78,11 +86,7 @@ where
     }
 }
 
-impl<TMapping> GeoShapeFieldType<TMapping> for GeoShape<TMapping>
-where
-    TMapping: GeoShapeMapping,
-{
-}
+impl<TMapping> GeoShapeFieldType<TMapping> for GeoShape<TMapping> where TMapping: GeoShapeMapping {}
 
 impl_mapping_type!(Geometry, GeoShape, GeoShapeMapping);
 
@@ -116,7 +120,10 @@ where
 mod tests {
     use serde_json;
 
-    use geojson::{Geometry, Value};
+    use geojson::{
+        Geometry,
+        Value,
+    };
     use prelude::*;
 
     #[derive(Default)]
@@ -129,22 +136,24 @@ mod tests {
             true
         }
 
-        let point: GeoShape<DefaultGeoShapeMapping> = GeoShape::new(Geometry::new(Value::Point(vec![1.0, 1.0])));
+        let point: GeoShape<DefaultGeoShapeMapping> =
+            GeoShape::new(Geometry::new(Value::Point(vec![1.0, 1.0])));
 
         assert!(takes_custom_mapping(GeoShape::remap(point)));
     }
 
     #[test]
     fn serialise_elastic_geo_shape() {
-        let shape = GeoShape::<DefaultGeoShapeMapping>::new(Geometry::new(Value::Point(vec![1.0, 1.0])));
+        let shape =
+            GeoShape::<DefaultGeoShapeMapping>::new(Geometry::new(Value::Point(vec![1.0, 1.0])));
 
         let ser = serde_json::to_string(&shape).unwrap();
 
         assert_eq!(
             json_str!({
-            "coordinates": [ 1.0, 1.0 ],
-            "type": "Point"
-        }),
+                "coordinates": [ 1.0, 1.0 ],
+                "type": "Point"
+            }),
             ser
         );
     }
@@ -154,7 +163,8 @@ mod tests {
         let shape: GeoShape<DefaultGeoShapeMapping> = serde_json::from_str(&json_str!({
             "coordinates": [ 1, 1 ],
             "type": "Point"
-        })).unwrap();
+        }))
+        .unwrap();
 
         assert_eq!(Geometry::new(Value::Point(vec![1.0, 1.0])), *shape);
     }
diff --git a/src/types/src/geo/shape/mapping.rs b/src/types/src/geo/shape/mapping.rs
index 5d2e3e74e4..1fe35579e4 100644
--- a/src/types/src/geo/shape/mapping.rs
+++ b/src/types/src/geo/shape/mapping.rs
@@ -1,7 +1,10 @@
 /*! Mapping for Elasticsearch `geo_shape` types. */
 
-use serde::{Serialize, Serializer};
 use geo::mapping::Distance;
+use serde::{
+    Serialize,
+    Serializer,
+};
 
 /** A field that will be mapped as a `geo_shape`. */
 pub trait GeoShapeFieldType<TMapping> {}
@@ -153,8 +156,10 @@ impl GeoShapeMapping for DefaultGeoShapeMapping {}
 
 /** Name of the `PrefixTree` implementation to be used. */
 pub enum Tree {
-    /** For `GeohashPrefixTree`. */ Geohash,
-    /** For `QuadPrefixTree`. */ QuadPrefix,
+    /** For `GeohashPrefixTree`. */
+    Geohash,
+    /** For `QuadPrefixTree`. */
+    QuadPrefix,
 }
 
 impl Serialize for Tree {
@@ -171,8 +176,10 @@ impl Serialize for Tree {
 
 /** The strategy defines the approach for how to represent shapes at indexing and search time. */
 pub enum Strategy {
-    /** Recursive strategy supports all shape types. */ Recursive,
-    /** Term strategy supports point types only. */ Term,
+    /** Recursive strategy supports all shape types. */
+    Recursive,
+    /** Term strategy supports point types only. */
+    Term,
 }
 
 impl Serialize for Strategy {
@@ -196,8 +203,10 @@ The default orientation (counterclockwise) complies with the OGC standard which
 ring vertices in counterclockwise order with inner ring(s) vertices (holes) in clockwise order.
 */
 pub enum Orientation {
-    /** For `cw`. */ Clockwise,
-    /** For `ccw`. */ CounterClockwise,
+    /** For `cw`. */
+    Clockwise,
+    /** For `ccw`. */
+    CounterClockwise,
 }
 
 impl Serialize for Orientation {
@@ -213,10 +222,21 @@ impl Serialize for Orientation {
 }
 
 mod private {
-    use serde::{Serialize, Serializer};
+    use super::{
+        GeoShapeFieldType,
+        GeoShapeMapping,
+    };
+    use private::field::{
+        FieldMapping,
+        FieldType,
+        SerializeFieldMapping,
+        StaticSerialize,
+    };
     use serde::ser::SerializeStruct;
-    use private::field::{StaticSerialize, SerializeFieldMapping, FieldMapping, FieldType};
-    use super::{GeoShapeFieldType, GeoShapeMapping};
+    use serde::{
+        Serialize,
+        Serializer,
+    };
 
     impl<TField, TMapping> FieldType<TMapping, GeoShapePivot> for TField
     where
diff --git a/src/types/src/geo/shape/mod.rs b/src/types/src/geo/shape/mod.rs
index eea92306fc..168b456456 100644
--- a/src/types/src/geo/shape/mod.rs
+++ b/src/types/src/geo/shape/mod.rs
@@ -67,7 +67,7 @@ pub use self::impls::*;
 pub mod prelude {
     /*!
     Includes all types for the `geo_shape` types.
-    
+
     This is a convenience module to make it easy to build mappings for multiple types without too many `use` statements.
     */
 
diff --git a/src/types/src/ip/impls.rs b/src/types/src/ip/impls.rs
index 52d7e30817..0f0d0555eb 100644
--- a/src/types/src/ip/impls.rs
+++ b/src/types/src/ip/impls.rs
@@ -1,11 +1,23 @@
+use super::mapping::{
+    DefaultIpMapping,
+    IpFieldType,
+    IpMapping,
+};
+use serde::de::{
+    Error,
+    Visitor,
+};
+use serde::{
+    Deserialize,
+    Deserializer,
+    Serialize,
+    Serializer,
+};
 use std::borrow::Borrow;
+use std::error::Error as StdError;
 use std::marker::PhantomData;
 use std::net::Ipv4Addr;
 use std::str::FromStr;
-use std::error::Error as StdError;
-use serde::{Deserialize, Deserializer, Serialize, Serializer};
-use serde::de::{Error, Visitor};
-use super::mapping::{DefaultIpMapping, IpFieldType, IpMapping};
 
 impl IpFieldType<DefaultIpMapping> for Ipv4Addr {}
 
@@ -41,16 +53,16 @@ where
 {
     /**
     Creates a new `Ip` with the given mapping.
-    
+
     # Examples
-    
+
     Create a new `Ip` from a `Ip4vAddr`:
-    
+
     ```
     use std::net::Ipv4Addr;
     use elastic_types::ip::mapping::DefaultIpMapping;
     use elastic_types::ip::Ip;
-    
+
     let ip = Ip::<DefaultIpMapping>::new(Ipv4Addr::new(127, 0, 0, 1));
     ```
     */
@@ -66,11 +78,11 @@ where
 
     /**
     Change the mapping of this ip.
-    
+
     # Examples
-    
+
     Change the mapping for a given `Ip`:
-    
+
     ```
     # extern crate serde;
     # #[macro_use]
@@ -82,7 +94,7 @@ where
     # struct MyIpMapping;
     # impl IpMapping for MyIpMapping { }
     let es_ip = Ip::<DefaultIpMapping>::new(Ipv4Addr::new(127, 0, 0, 1));
-    
+
     let ip: Ip<MyIpMapping> = Ip::remap(es_ip);
     # }
     ```
@@ -95,11 +107,7 @@ where
     }
 }
 
-impl<TMapping> IpFieldType<TMapping> for Ip<TMapping>
-where
-    TMapping: IpMapping,
-{
-}
+impl<TMapping> IpFieldType<TMapping> for Ip<TMapping> where TMapping: IpMapping {}
 
 impl_mapping_type!(Ipv4Addr, Ip, IpMapping);
 
@@ -143,7 +151,9 @@ where
             where
                 E: Error,
             {
-                let de = try!(Ipv4Addr::from_str(&v).map_err(|e| E::custom(e.description().to_string())));
+                let de = try!(
+                    Ipv4Addr::from_str(&v).map_err(|e| E::custom(e.description().to_string()))
+                );
 
                 Ok(Ip::new(de))
             }
@@ -152,7 +162,8 @@ where
             where
                 E: Error,
             {
-                let de = try!(Ipv4Addr::from_str(v).map_err(|e| E::custom(e.description().to_string())));
+                let de =
+                    try!(Ipv4Addr::from_str(v).map_err(|e| E::custom(e.description().to_string())));
 
                 Ok(Ip::new(de))
             }
diff --git a/src/types/src/ip/mapping.rs b/src/types/src/ip/mapping.rs
index 3d910a7d81..9c11f77a5a 100644
--- a/src/types/src/ip/mapping.rs
+++ b/src/types/src/ip/mapping.rs
@@ -107,10 +107,21 @@ pub struct DefaultIpMapping;
 impl IpMapping for DefaultIpMapping {}
 
 mod private {
-    use serde::{Serialize, Serializer};
+    use super::{
+        IpFieldType,
+        IpMapping,
+    };
+    use private::field::{
+        FieldMapping,
+        FieldType,
+        SerializeFieldMapping,
+        StaticSerialize,
+    };
     use serde::ser::SerializeStruct;
-    use private::field::{StaticSerialize, SerializeFieldMapping, FieldMapping, FieldType};
-    use super::{IpFieldType, IpMapping};
+    use serde::{
+        Serialize,
+        Serializer,
+    };
 
     #[derive(Default)]
     pub struct IpPivot;
diff --git a/src/types/src/ip/mod.rs b/src/types/src/ip/mod.rs
index 9ace2d0c32..c0f06dc8b5 100644
--- a/src/types/src/ip/mod.rs
+++ b/src/types/src/ip/mod.rs
@@ -61,7 +61,7 @@ pub use self::impls::*;
 pub mod prelude {
     /*!
     Includes all types for the `ip` type.
-    
+
     This is a convenience module to make it easy to build mappings for multiple types without too many `use` statements.
     */
 
diff --git a/src/types/src/lib.rs b/src/types/src/lib.rs
index 081d93bfe6..e3823d84ba 100644
--- a/src/types/src/lib.rs
+++ b/src/types/src/lib.rs
@@ -532,9 +532,9 @@ extern crate json_str;
 #[macro_use]
 mod private;
 
-pub mod document;
-pub mod date;
 pub mod boolean;
+pub mod date;
+pub mod document;
 pub mod geo;
 pub mod ip;
 pub mod number;
@@ -546,7 +546,7 @@ pub mod derive;
 pub mod prelude {
     /*!
     Includes all data types.
-    
+
     This is a convenience module to make it easy to build mappings for multiple types without too many `use` statements.
     */
 
diff --git a/src/types/src/number/impls.rs b/src/types/src/number/impls.rs
index 26ed6c226c..7630b29f57 100644
--- a/src/types/src/number/impls.rs
+++ b/src/types/src/number/impls.rs
@@ -1,56 +1,75 @@
+use super::mapping::*;
+use serde::{
+    Deserialize,
+    Deserializer,
+    Serialize,
+    Serializer,
+};
 use std::borrow::Borrow;
 use std::marker::PhantomData;
-use serde::{Deserialize, Deserializer, Serialize, Serializer};
-use super::mapping::*;
 
 macro_rules! number_type {
-    ($wrapper_ty:ident, $mapping_ty:ident, $field_trait:ident, $std_ty:ident) => (
+    ($wrapper_ty:ident, $mapping_ty:ident, $field_trait:ident, $std_ty:ident) => {
         /** Number type with a given mapping. */
         #[derive(Debug, Default, Clone, PartialEq)]
-        pub struct $wrapper_ty<TMapping>  where TMapping: $mapping_ty {
+        pub struct $wrapper_ty<TMapping>
+        where
+            TMapping: $mapping_ty,
+        {
             value: $std_ty,
-            _m: PhantomData<TMapping>
+            _m: PhantomData<TMapping>,
         }
 
-        impl<TMapping> $wrapper_ty<TMapping> where TMapping: $mapping_ty {
+        impl<TMapping> $wrapper_ty<TMapping>
+        where
+            TMapping: $mapping_ty,
+        {
             /** Creates a new number with the given mapping. */
             pub fn new<I: Into<$std_ty>>(num: I) -> $wrapper_ty<TMapping> {
-                $wrapper_ty {
-                    value: num.into(),
-                    _m: PhantomData
-                }
+                $wrapper_ty { value: num.into(), _m: PhantomData }
             }
 
             /** Change the mapping of this number. */
             pub fn remap<TNewMapping>(number: $wrapper_ty<TMapping>) -> $wrapper_ty<TNewMapping>
-                where TNewMapping: $mapping_ty
+            where
+                TNewMapping: $mapping_ty,
             {
                 $wrapper_ty::new(number.value)
             }
         }
 
-        impl<TMapping> $field_trait<TMapping> for $wrapper_ty<TMapping> where TMapping: $mapping_ty { }
+        impl<TMapping> $field_trait<TMapping> for $wrapper_ty<TMapping> where TMapping: $mapping_ty {}
 
         impl_mapping_type!($std_ty, $wrapper_ty, $mapping_ty);
 
         //Serialize elastic number.
-        impl<TMapping> Serialize for $wrapper_ty<TMapping> where TMapping: $mapping_ty {
-            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
-            S: Serializer {
+        impl<TMapping> Serialize for $wrapper_ty<TMapping>
+        where
+            TMapping: $mapping_ty,
+        {
+            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
+            where
+                S: Serializer,
+            {
                 self.value.serialize(serializer)
             }
         }
 
         //Deserialize elastic number.
-        impl <'de, TMapping> Deserialize<'de> for $wrapper_ty<TMapping> where TMapping: $mapping_ty {
-            fn deserialize<D>(deserializer: D) -> Result<$wrapper_ty<TMapping>, D::Error> where
-            D: Deserializer<'de> {
+        impl<'de, TMapping> Deserialize<'de> for $wrapper_ty<TMapping>
+        where
+            TMapping: $mapping_ty,
+        {
+            fn deserialize<D>(deserializer: D) -> Result<$wrapper_ty<TMapping>, D::Error>
+            where
+                D: Deserializer<'de>,
+            {
                 let t = try!($std_ty::deserialize(deserializer));
 
                 Ok($wrapper_ty::new(t))
             }
         }
-    )
+    };
 }
 
 number_type!(Integer, IntegerMapping, IntegerFieldType, i32);
@@ -154,14 +173,7 @@ mod tests {
 
         assert_eq!(
             (1i32, 1i64, 1i16, 1i8, 1.01f32, 1.01f64),
-            (
-                *int_de,
-                *long_de,
-                *short_de,
-                *byte_de,
-                *float_de,
-                *double_de
-            )
+            (*int_de, *long_de, *short_de, *byte_de, *float_de, *double_de)
         );
     }
 }
diff --git a/src/types/src/number/mapping.rs b/src/types/src/number/mapping.rs
index 17be94ec40..22d42a04ad 100644
--- a/src/types/src/number/mapping.rs
+++ b/src/types/src/number/mapping.rs
@@ -60,31 +60,41 @@ This will produce the following mapping:
 */
 
 macro_rules! number_mapping {
-    ($mapping:ident, $pivot:ident, $field_trait:ident, $datatype_name:expr, $std_ty:ty, $private_mod:ident) => (
+    ($mapping:ident, $pivot:ident, $field_trait:ident, $datatype_name:expr, $std_ty:ty, $private_mod:ident) => {
         /** A field that will be mapped as a number. */
         pub trait $field_trait<TMapping> {}
 
         /** Base `number` mapping. */
-        pub trait $mapping where
-        Self: Default {
+        pub trait $mapping
+        where
+            Self: Default,
+        {
             /** Try to convert strings to numbers and truncate fractions for integers. Accepts `true` (default) and `false`. */
-            fn coerce() -> Option<bool> { None }
+            fn coerce() -> Option<bool> {
+                None
+            }
 
             /** Field-level index time boosting. Accepts a floating point number, defaults to `1.0`. */
-            fn boost() -> Option<f32> { None }
+            fn boost() -> Option<f32> {
+                None
+            }
 
             /**
             Should the field be stored on disk in a column-stride fashion,
             so that it can later be used for sorting, aggregations, or scripting?
             Accepts `true` (default) or `false`.
             */
-            fn doc_values() -> Option<bool> { None }
+            fn doc_values() -> Option<bool> {
+                None
+            }
 
             /**
             If `true`, malformed numbers are ignored. If `false` (default),
             malformed numbers throw an exception and reject the whole document.
             */
-            fn ignore_malformed() -> Option<bool> { None }
+            fn ignore_malformed() -> Option<bool> {
+                None
+            }
 
             /**
             Whether or not the field value should be included in the `_all` field?
@@ -92,51 +102,67 @@ macro_rules! number_mapping {
             or if a parent object field sets `include_in_all` to false.
             Otherwise defaults to `true`.
             */
-            fn include_in_all() -> Option<bool> { None }
+            fn include_in_all() -> Option<bool> {
+                None
+            }
 
             /** Should the field be searchable? Accepts `not_analyzed` (default) and `no`. */
-            fn index() -> Option<bool> { None }
+            fn index() -> Option<bool> {
+                None
+            }
 
             /**
             Accepts a numeric value of the same type as the field which is substituted for any explicit null values.
             Defaults to `null`, which means the field is treated as missing.
             */
-            fn null_value() -> Option<$std_ty> { None }
+            fn null_value() -> Option<$std_ty> {
+                None
+            }
 
             /**
             Whether the field value should be stored and retrievable separately from the `_source` field.
             Accepts true or false (default).
             */
-            fn store() -> Option<bool> { None }
+            fn store() -> Option<bool> {
+                None
+            }
         }
 
         mod $private_mod {
-            use serde::Serialize;
-            use serde::ser::SerializeStruct;
-            use private::field::{StaticSerialize, FieldType, SerializeFieldMapping, FieldMapping};
             use super::{$field_trait, $mapping};
+            use private::field::{FieldMapping, FieldType, SerializeFieldMapping, StaticSerialize};
+            use serde::ser::SerializeStruct;
+            use serde::Serialize;
 
             #[derive(Default)]
             pub struct $pivot;
 
             impl<TField, TMapping> FieldType<TMapping, $pivot> for TField
-                where TField: $field_trait<TMapping> + Serialize,
-                      TMapping: $mapping
-            { }
+            where
+                TField: $field_trait<TMapping> + Serialize,
+                TMapping: $mapping,
+            {
+            }
 
             impl<TMapping> FieldMapping<$pivot> for TMapping
-                where TMapping: $mapping
+            where
+                TMapping: $mapping,
             {
                 type SerializeFieldMapping = SerializeFieldMapping<TMapping, $pivot>;
 
-                fn data_type() -> &'static str { $datatype_name }
+                fn data_type() -> &'static str {
+                    $datatype_name
+                }
             }
 
             impl<TMapping> StaticSerialize for SerializeFieldMapping<TMapping, $pivot>
-                where TMapping: FieldMapping<$pivot> + $mapping
+            where
+                TMapping: FieldMapping<$pivot> + $mapping,
             {
-                fn static_serialize<S>(serializer: S) -> Result<S::Ok, S::Error> where
-                S: ::serde::Serializer {
+                fn static_serialize<S>(serializer: S) -> Result<S::Ok, S::Error>
+                where
+                    S: ::serde::Serializer,
+                {
                     let mut state = try!(serializer.serialize_struct("mapping", 8));
 
                     try!(state.serialize_field("type", TMapping::data_type()));
@@ -153,7 +179,7 @@ macro_rules! number_mapping {
                 }
             }
         }
-    )
+    };
 }
 
 number_mapping!(
diff --git a/src/types/src/number/mod.rs b/src/types/src/number/mod.rs
index 00fde25ad1..59f5e1b194 100644
--- a/src/types/src/number/mod.rs
+++ b/src/types/src/number/mod.rs
@@ -74,7 +74,7 @@ pub use self::impls::*;
 pub mod prelude {
     /*!
     Includes all types for the `number` type.
-    
+
     This is a convenience module to make it easy to build mappings for multiple types without too many `use` statements.
     */
 
diff --git a/src/types/src/private/field.rs b/src/types/src/private/field.rs
index e17bfb4627..173627ee3b 100644
--- a/src/types/src/private/field.rs
+++ b/src/types/src/private/field.rs
@@ -5,10 +5,13 @@ Most of these types have a generic `TPivot` parameter.
 The idea is to use a concrete type for `TPivot` so non-overlapping blanket implementations can be added for `TMapping`.
 */
 
-use std::marker::PhantomData;
+use serde::ser::{
+    Serialize,
+    Serializer,
+};
 use std::borrow::Borrow;
+use std::marker::PhantomData;
 use std::ops::Deref;
-use serde::ser::{Serialize, Serializer};
 
 pub trait StaticSerialize {
     fn static_serialize<S>(serializer: S) -> Result<S::Ok, S::Error>
@@ -21,7 +24,6 @@ pub trait FieldType<TMapping, TPivot>
 where
     TMapping: FieldMapping<TPivot>,
 {
-    
 }
 
 /** The base representation of an Elasticsearch data type mapping. */
diff --git a/src/types/src/private/impls.rs b/src/types/src/private/impls.rs
index 887a4c1f52..fd19a6c953 100644
--- a/src/types/src/private/impls.rs
+++ b/src/types/src/private/impls.rs
@@ -1,10 +1,21 @@
+use serde::ser::SerializeStruct;
+use serde::{
+    Serialize,
+    Serializer,
+};
+use std::collections::{
+    BTreeMap,
+    HashMap,
+};
 use std::hash::Hash;
 use std::marker::PhantomData;
-use std::collections::{BTreeMap, HashMap};
-use serde::{Serialize, Serializer};
-use serde::ser::SerializeStruct;
 
-use super::field::{SerializeFieldMapping, StaticSerialize, FieldMapping, FieldType};
+use super::field::{
+    FieldMapping,
+    FieldType,
+    SerializeFieldMapping,
+    StaticSerialize,
+};
 
 pub trait DefaultFieldType {}
 
@@ -62,7 +73,8 @@ where
     }
 }
 
-impl<TMapping, TPivot> StaticSerialize for SerializeFieldMapping<WrappedMapping<TMapping, TPivot>, TPivot>
+impl<TMapping, TPivot> StaticSerialize
+    for SerializeFieldMapping<WrappedMapping<TMapping, TPivot>, TPivot>
 where
     TMapping: FieldMapping<TPivot>,
 {
@@ -74,11 +86,7 @@ where
     }
 }
 
-impl<TField> FieldType<DefaultMapping, ()> for TField
-where
-    TField: DefaultFieldType,
-{
-}
+impl<TField> FieldType<DefaultMapping, ()> for TField where TField: DefaultFieldType {}
 
 /** Mapping implementation for a standard binary tree map. */
 impl<K, V> DefaultFieldType for BTreeMap<K, V>
diff --git a/src/types/src/private/macros.rs b/src/types/src/private/macros.rs
index 357293b839..4e7b102db8 100644
--- a/src/types/src/private/macros.rs
+++ b/src/types/src/private/macros.rs
@@ -1,36 +1,39 @@
 macro_rules! ser_field {
-    ($serializer:ident, $field:expr, $val_opt:expr) => (
+    ($serializer:ident, $field:expr, $val_opt:expr) => {
         if let Some(f) = $val_opt {
             try!($serializer.serialize_field($field, &f));
         }
-    )
+    };
 }
 
 macro_rules! borrow_fn {
-    ($std_ty:ident) => (
-        fn borrow<T>(value: &T) -> &$std_ty where T: Borrow<$std_ty> {
+    ($std_ty:ident) => {
+        fn borrow<T>(value: &T) -> &$std_ty
+        where
+            T: Borrow<$std_ty>,
+        {
             value.borrow()
         }
-    )
+    };
 }
 
 macro_rules! impl_mapping_type {
-    ($std_ty:ident, $wrapper_ty:ident, $mapping_ty:ident) => (
-        impl<M> ::private::field::StdField<$std_ty> for $wrapper_ty<M> where
-        M: $mapping_ty
-        {
+    ($std_ty:ident, $wrapper_ty:ident, $mapping_ty:ident) => {
+        impl<M> ::private::field::StdField<$std_ty> for $wrapper_ty<M> where M: $mapping_ty {}
 
-        }
-
-        impl<M> From<$std_ty> for $wrapper_ty<M> where
-        M: $mapping_ty {
+        impl<M> From<$std_ty> for $wrapper_ty<M>
+        where
+            M: $mapping_ty,
+        {
             fn from(value: $std_ty) -> Self {
                 $wrapper_ty::new(value)
             }
         }
 
-        impl<M> PartialEq<$std_ty> for $wrapper_ty<M> where
-        M: $mapping_ty {
+        impl<M> PartialEq<$std_ty> for $wrapper_ty<M>
+        where
+            M: $mapping_ty,
+        {
             fn eq(&self, other: &$std_ty) -> bool {
                 borrow_fn!($std_ty);
 
@@ -44,8 +47,10 @@ macro_rules! impl_mapping_type {
             }
         }
 
-        impl<M> PartialEq<$wrapper_ty<M>> for $std_ty where
-        M: $mapping_ty {
+        impl<M> PartialEq<$wrapper_ty<M>> for $std_ty
+        where
+            M: $mapping_ty,
+        {
             fn eq(&self, other: &$wrapper_ty<M>) -> bool {
                 borrow_fn!($std_ty);
 
@@ -59,8 +64,10 @@ macro_rules! impl_mapping_type {
             }
         }
 
-        impl<M> ::std::ops::Deref for $wrapper_ty<M> where
-        M: $mapping_ty {
+        impl<M> ::std::ops::Deref for $wrapper_ty<M>
+        where
+            M: $mapping_ty,
+        {
             type Target = $std_ty;
             fn deref(&self) -> &$std_ty {
                 borrow_fn!($std_ty);
@@ -69,13 +76,15 @@ macro_rules! impl_mapping_type {
             }
         }
 
-        impl<M> ::std::borrow::Borrow<$std_ty> for $wrapper_ty<M> where
-        M: $mapping_ty {
+        impl<M> ::std::borrow::Borrow<$std_ty> for $wrapper_ty<M>
+        where
+            M: $mapping_ty,
+        {
             fn borrow(&self) -> &$std_ty {
                 borrow_fn!($std_ty);
 
                 borrow(&self.value)
             }
         }
-    );
+    };
 }
diff --git a/src/types/src/string/keyword/impls.rs b/src/types/src/string/keyword/impls.rs
index bb22375584..e86a226d2a 100644
--- a/src/types/src/string/keyword/impls.rs
+++ b/src/types/src/string/keyword/impls.rs
@@ -1,8 +1,19 @@
+use super::mapping::{
+    KeywordFieldType,
+    KeywordMapping,
+};
+use serde::de::{
+    Error,
+    Visitor,
+};
+use serde::{
+    Deserialize,
+    Deserializer,
+    Serialize,
+    Serializer,
+};
 use std::borrow::Borrow;
 use std::marker::PhantomData;
-use serde::{Deserialize, Deserializer, Serialize, Serializer};
-use serde::de::{Error, Visitor};
-use super::mapping::{KeywordFieldType, KeywordMapping};
 
 /**
 An Elasticsearch `keyword` with a mapping.
@@ -35,15 +46,15 @@ where
 {
     /**
     Creates a new `Keyword` with the given mapping.
-    
+
     # Examples
-    
+
     Create a new `Keyword` from a `String`:
-    
+
     ```
     use elastic_types::string::keyword::mapping::DefaultKeywordMapping;
     use elastic_types::string::keyword::Keyword;
-    
+
     let string = Keyword::<DefaultKeywordMapping>::new("my string");
     ```
     */
diff --git a/src/types/src/string/keyword/mapping.rs b/src/types/src/string/keyword/mapping.rs
index b1d5f03ecf..b0befeb7a2 100644
--- a/src/types/src/string/keyword/mapping.rs
+++ b/src/types/src/string/keyword/mapping.rs
@@ -1,10 +1,16 @@
 /*! Mapping for the Elasticsearch `keyword` type. */
 
-use std::collections::BTreeMap;
-use serde::{Serialize, Serializer};
-use serde::ser::SerializeStruct;
-use string::mapping::{IndexOptions, StringField};
 use private::field::FieldMapping;
+use serde::ser::SerializeStruct;
+use serde::{
+    Serialize,
+    Serializer,
+};
+use std::collections::BTreeMap;
+use string::mapping::{
+    IndexOptions,
+    StringField,
+};
 
 /** A field that will be mapped as a `keyword`. */
 pub trait KeywordFieldType<TMapping> {}
@@ -249,9 +255,12 @@ pub struct KeywordFieldMapping {
     Any characters over this length will be ignored.
     */
     pub ignore_above: Option<u32>,
-    /** Should the field be searchable? Accepts `true` (default) or `false`. */ pub index: Option<bool>,
-    /** What information should be stored in the index, for search and highlighting purposes. Defaults to `Positions`. */ pub index_options: Option<IndexOptions>,
-    /** Whether field-length should be taken into account when scoring queries. Accepts `true` (default) or `false`. */ pub norms: Option<bool>,
+    /** Should the field be searchable? Accepts `true` (default) or `false`. */
+    pub index: Option<bool>,
+    /** What information should be stored in the index, for search and highlighting purposes. Defaults to `Positions`. */
+    pub index_options: Option<IndexOptions>,
+    /** Whether field-length should be taken into account when scoring queries. Accepts `true` (default) or `false`. */
+    pub norms: Option<bool>,
     /**
     Whether the field value should be stored and retrievable separately from the `_source` field.
     Accepts `true` or `false` (default).
@@ -295,10 +304,21 @@ impl Serialize for KeywordFieldMapping {
 }
 
 mod private {
-    use serde::{Serialize, Serializer};
+    use super::{
+        KeywordFieldType,
+        KeywordMapping,
+    };
+    use private::field::{
+        FieldMapping,
+        FieldType,
+        SerializeFieldMapping,
+        StaticSerialize,
+    };
     use serde::ser::SerializeStruct;
-    use private::field::{StaticSerialize, SerializeFieldMapping, FieldMapping, FieldType};
-    use super::{KeywordFieldType, KeywordMapping};
+    use serde::{
+        Serialize,
+        Serializer,
+    };
 
     #[derive(Default)]
     pub struct KeywordPivot;
diff --git a/src/types/src/string/keyword/mod.rs b/src/types/src/string/keyword/mod.rs
index d59b62a11c..5147b2f6f3 100644
--- a/src/types/src/string/keyword/mod.rs
+++ b/src/types/src/string/keyword/mod.rs
@@ -15,7 +15,7 @@ pub use self::impls::*;
 pub mod prelude {
     /*!
     Includes all types for the `keyword` type.
-    
+
     This is a convenience module to make it easy to build mappings for multiple types without too many `use` statements.
     */
 
diff --git a/src/types/src/string/macros.rs b/src/types/src/string/macros.rs
index 2c6c90a0ec..1ae8d68b66 100644
--- a/src/types/src/string/macros.rs
+++ b/src/types/src/string/macros.rs
@@ -1,13 +1,12 @@
 macro_rules! impl_string_type {
-    ($wrapper_ty:ident, $mapping_ty:ident, $field_type:ident) => (
-        impl<TMapping> $field_type<TMapping> for $wrapper_ty<TMapping> where
-        TMapping: $mapping_ty { }
+    ($wrapper_ty:ident, $mapping_ty:ident, $field_type:ident) => {
+        impl<TMapping> $field_type<TMapping> for $wrapper_ty<TMapping> where TMapping: $mapping_ty {}
 
         impl_mapping_type!(String, $wrapper_ty, $mapping_ty);
 
         impl<'a, TMapping> From<$wrapper_ty<TMapping>> for String
         where
-            TMapping: $mapping_ty
+            TMapping: $mapping_ty,
         {
             fn from(wrapper: $wrapper_ty<TMapping>) -> Self {
                 wrapper.value
@@ -16,7 +15,7 @@ macro_rules! impl_string_type {
 
         impl<'a, TMapping> From<&'a $wrapper_ty<TMapping>> for std::borrow::Cow<'a, str>
         where
-            TMapping: $mapping_ty
+            TMapping: $mapping_ty,
         {
             fn from(wrapper: &'a $wrapper_ty<TMapping>) -> Self {
                 wrapper.as_ref().into()
@@ -25,33 +24,39 @@ macro_rules! impl_string_type {
 
         impl<'a, TMapping> From<$wrapper_ty<TMapping>> for std::borrow::Cow<'a, str>
         where
-            TMapping: $mapping_ty
+            TMapping: $mapping_ty,
         {
             fn from(wrapper: $wrapper_ty<TMapping>) -> Self {
                 String::from(wrapper).into()
             }
         }
 
-        impl<TMapping> AsRef<str> for $wrapper_ty<TMapping> where
-        TMapping: $mapping_ty {
+        impl<TMapping> AsRef<str> for $wrapper_ty<TMapping>
+        where
+            TMapping: $mapping_ty,
+        {
             fn as_ref(&self) -> &str {
                 &self.value
             }
         }
 
-        impl<'a, TMapping> PartialEq<&'a str> for $wrapper_ty<TMapping> where
-        TMapping: $mapping_ty {
-            fn eq(&self, other: & &'a str) -> bool {
+        impl<'a, TMapping> PartialEq<&'a str> for $wrapper_ty<TMapping>
+        where
+            TMapping: $mapping_ty,
+        {
+            fn eq(&self, other: &&'a str) -> bool {
                 PartialEq::eq(&self.value, *other)
             }
 
-            fn ne(&self, other: & &'a str) -> bool {
+            fn ne(&self, other: &&'a str) -> bool {
                 PartialEq::ne(&self.value, *other)
             }
         }
 
-        impl<'a, TMapping> PartialEq<$wrapper_ty<TMapping>> for &'a str where
-        TMapping: $mapping_ty {
+        impl<'a, TMapping> PartialEq<$wrapper_ty<TMapping>> for &'a str
+        where
+            TMapping: $mapping_ty,
+        {
             fn eq(&self, other: &$wrapper_ty<TMapping>) -> bool {
                 PartialEq::eq(*self, &other.value)
             }
@@ -61,33 +66,47 @@ macro_rules! impl_string_type {
             }
         }
 
-        impl<TMapping> Serialize for $wrapper_ty<TMapping> where
-        TMapping: $mapping_ty {
-            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
-            S: Serializer {
+        impl<TMapping> Serialize for $wrapper_ty<TMapping>
+        where
+            TMapping: $mapping_ty,
+        {
+            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
+            where
+                S: Serializer,
+            {
                 serializer.serialize_str(&self.value)
             }
         }
 
-        impl<'de, TMapping> Deserialize<'de> for $wrapper_ty<TMapping> where
-        TMapping: $mapping_ty {
-            fn deserialize<D>(deserializer: D) -> Result<$wrapper_ty<TMapping>, D::Error> where
-            D: Deserializer<'de> {
+        impl<'de, TMapping> Deserialize<'de> for $wrapper_ty<TMapping>
+        where
+            TMapping: $mapping_ty,
+        {
+            fn deserialize<D>(deserializer: D) -> Result<$wrapper_ty<TMapping>, D::Error>
+            where
+                D: Deserializer<'de>,
+            {
                 struct StringVisitor<TMapping> {
-                    _m: PhantomData<TMapping>
+                    _m: PhantomData<TMapping>,
                 }
 
-                impl<'de, TMapping> Visitor<'de> for StringVisitor<TMapping> where
-                TMapping: $mapping_ty {
+                impl<'de, TMapping> Visitor<'de> for StringVisitor<TMapping>
+                where
+                    TMapping: $mapping_ty,
+                {
                     type Value = $wrapper_ty<TMapping>;
 
-                    fn expecting(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result
-                    {
+                    fn expecting(
+                        &self,
+                        formatter: &mut ::std::fmt::Formatter,
+                    ) -> ::std::fmt::Result {
                         write!(formatter, "a json string")
                     }
 
-                    fn visit_str<E>(self, v: &str) -> Result<$wrapper_ty<TMapping>, E> where
-                    E: Error {
+                    fn visit_str<E>(self, v: &str) -> Result<$wrapper_ty<TMapping>, E>
+                    where
+                        E: Error,
+                    {
                         Ok($wrapper_ty::new(v))
                     }
                 }
@@ -95,5 +114,5 @@ macro_rules! impl_string_type {
                 deserializer.deserialize_any(StringVisitor { _m: PhantomData })
             }
         }
-    );
+    };
 }
diff --git a/src/types/src/string/mapping.rs b/src/types/src/string/mapping.rs
index 8a8dae3527..e6aef74326 100644
--- a/src/types/src/string/mapping.rs
+++ b/src/types/src/string/mapping.rs
@@ -1,10 +1,16 @@
 /*! Common mapping for the Elasticsearch `string` types. */
 
-use std::collections::BTreeMap;
-use serde::{Serialize, Serializer};
-use serde::ser::SerializeStruct;
-use super::text::mapping::{TextFieldMapping, TextMapping};
 use super::keyword::mapping::KeywordFieldMapping;
+use super::text::mapping::{
+    TextFieldMapping,
+    TextMapping,
+};
+use serde::ser::SerializeStruct;
+use serde::{
+    Serialize,
+    Serializer,
+};
+use std::collections::BTreeMap;
 
 /** Default mapping for `String`. */
 #[derive(PartialEq, Debug, Default, Clone, Copy)]
@@ -27,7 +33,8 @@ impl TextMapping for DefaultStringMapping {
 /** The `index_options` parameter controls what information is added to the inverted index, for search and highlighting purposes. */
 #[derive(Debug, Clone, Copy)]
 pub enum IndexOptions {
-    /** Only the doc number is indexed. Can answer the question Does this term exist in this field? */ Docs,
+    /** Only the doc number is indexed. Can answer the question Does this term exist in this field? */
+    Docs,
     /**
     Doc number and term frequencies are indexed.
     Term frequencies are used to score repeated terms higher than single terms.
@@ -67,10 +74,14 @@ String types can have a number of alternative field representations for differen
 */
 #[derive(Debug, Clone, Copy)]
 pub enum StringField {
-    /** A `token_count` sub field. */ TokenCount(ElasticTokenCountFieldMapping),
-    /** A `completion` suggester sub field. */ Completion(ElasticCompletionFieldMapping),
-    /** A `keyword` sub field. */ Keyword(KeywordFieldMapping),
-    /** A `text` sub field. */ Text(TextFieldMapping),
+    /** A `token_count` sub field. */
+    TokenCount(ElasticTokenCountFieldMapping),
+    /** A `completion` suggester sub field. */
+    Completion(ElasticCompletionFieldMapping),
+    /** A `keyword` sub field. */
+    Keyword(KeywordFieldMapping),
+    /** A `text` sub field. */
+    Text(TextFieldMapping),
 }
 
 impl Serialize for StringField {
@@ -96,14 +107,16 @@ pub struct ElasticTokenCountFieldMapping {
     Defaults to the default index analyzer, or the `standard` analyzer.
     */
     pub analyzer: Option<&'static str>,
-    /** Field-level index time boosting. Accepts a floating point number, defaults to `1.0`. */ pub boost: Option<f32>,
+    /** Field-level index time boosting. Accepts a floating point number, defaults to `1.0`. */
+    pub boost: Option<f32>,
     /**
     Should the field be stored on disk in a column-stride fashion,
     so that it can later be used for sorting, aggregations, or scripting?
     Accepts `true` (default) or `false`.
     */
     pub doc_values: Option<bool>,
-    /** Should the field be searchable? Accepts `not_analyzed` (default) and `no`. */ pub index: Option<IndexAnalysis>,
+    /** Should the field be searchable? Accepts `not_analyzed` (default) and `no`. */
+    pub index: Option<IndexAnalysis>,
     /**
     Whether or not the field value should be included in the `_all` field?
     Accepts true or false.
@@ -153,8 +166,10 @@ pub struct ElasticCompletionFieldMapping {
     Defaults to the default index analyzer, or the `standard` analyzer.
     */
     pub analyzer: Option<&'static str>,
-    /** The search analyzer to use, defaults to value of analyzer. */ pub search_analyzer: Option<&'static str>,
-    /** Enables the storing of payloads, defaults to `false`. */ pub payloads: Option<bool>,
+    /** The search analyzer to use, defaults to value of analyzer. */
+    pub search_analyzer: Option<&'static str>,
+    /** Enables the storing of payloads, defaults to `false`. */
+    pub payloads: Option<bool>,
     /**
     Preserves the separators, defaults to `true`.
     If disabled, you could find a field starting with Foo Fighters,
@@ -222,7 +237,8 @@ pub enum IndexAnalysis {
     `not_analyzed` fields are usually used with term-level queries for structured search.
     */
     NotAnalyzed,
-    /** Do not add this field value to the index. With this setting, the field will not be queryable. */ No,
+    /** Do not add this field value to the index. With this setting, the field will not be queryable. */
+    No,
 }
 
 impl Serialize for IndexAnalysis {
@@ -563,9 +579,10 @@ mod tests {
             IndexOptions::Freqs,
             IndexOptions::Positions,
             IndexOptions::Offsets,
-        ].iter()
-            .map(|i| serde_json::to_string(i).unwrap())
-            .collect();
+        ]
+        .iter()
+        .map(|i| serde_json::to_string(i).unwrap())
+        .collect();
 
         let expected_opts = vec![r#""docs""#, r#""freqs""#, r#""positions""#, r#""offsets""#];
 
@@ -588,9 +605,10 @@ mod tests {
             TermVector::WithPositions,
             TermVector::WithOffsets,
             TermVector::WithPositionsOffsets,
-        ].iter()
-            .map(|i| serde_json::to_string(i).unwrap())
-            .collect();
+        ]
+        .iter()
+        .map(|i| serde_json::to_string(i).unwrap())
+        .collect();
 
         let expected_opts = vec![
             r#""no""#,
diff --git a/src/types/src/string/mod.rs b/src/types/src/string/mod.rs
index 21195ab529..dc9eb82eb3 100644
--- a/src/types/src/string/mod.rs
+++ b/src/types/src/string/mod.rs
@@ -95,13 +95,13 @@ pub use self::text::Text;
 pub mod prelude {
     /*!
     Includes all types for the `string` types.
-    
+
     This is a convenience module to make it easy to build mappings for multiple types without too many `use` statements.
     */
 
     pub use super::keyword::prelude::*;
-    pub use super::text::prelude::*;
     pub use super::mapping::*;
+    pub use super::text::prelude::*;
 }
 
 #[cfg(test)]
@@ -140,7 +140,8 @@ mod tests {
 
     #[test]
     fn deserialise_elastic_keyword() {
-        let string: Keyword<DefaultKeywordMapping> = serde_json::from_str(r#""my string""#).unwrap();
+        let string: Keyword<DefaultKeywordMapping> =
+            serde_json::from_str(r#""my string""#).unwrap();
 
         assert_eq!("my string", string);
     }
diff --git a/src/types/src/string/text/impls.rs b/src/types/src/string/text/impls.rs
index 3af8f4ec96..44583b4c9a 100644
--- a/src/types/src/string/text/impls.rs
+++ b/src/types/src/string/text/impls.rs
@@ -1,8 +1,19 @@
+use super::mapping::{
+    TextFieldType,
+    TextMapping,
+};
+use serde::de::{
+    Error,
+    Visitor,
+};
+use serde::{
+    Deserialize,
+    Deserializer,
+    Serialize,
+    Serializer,
+};
 use std::borrow::Borrow;
 use std::marker::PhantomData;
-use serde::{Deserialize, Deserializer, Serialize, Serializer};
-use serde::de::{Error, Visitor};
-use super::mapping::{TextFieldType, TextMapping};
 use string::mapping::DefaultStringMapping;
 
 impl TextFieldType<DefaultStringMapping> for String {}
@@ -39,15 +50,15 @@ where
 {
     /**
     Creates a new `Text` with the given mapping.
-    
+
     # Examples
-    
+
     Create a new `Text` from a `String`:
-    
+
     ```
     use elastic_types::string::text::mapping::DefaultTextMapping;
     use elastic_types::string::text::Text;
-    
+
     let string = Text::<DefaultTextMapping>::new("my string");
     ```
     */
diff --git a/src/types/src/string/text/mapping.rs b/src/types/src/string/text/mapping.rs
index 956b734b7c..6ecfd66af4 100644
--- a/src/types/src/string/text/mapping.rs
+++ b/src/types/src/string/text/mapping.rs
@@ -1,10 +1,16 @@
 /*! Mapping for the Elasticsearch `text` type. */
 
-use std::collections::BTreeMap;
-use serde::{Serialize, Serializer};
-use serde::ser::SerializeStruct;
-use string::mapping::{IndexOptions, StringField};
 use private::field::FieldMapping;
+use serde::ser::SerializeStruct;
+use serde::{
+    Serialize,
+    Serializer,
+};
+use std::collections::BTreeMap;
+use string::mapping::{
+    IndexOptions,
+    StringField,
+};
 
 /** A field that will be mapped as `text`. */
 pub trait TextFieldType<TMapping> {}
@@ -242,11 +248,16 @@ impl TextMapping for DefaultTextMapping {}
 /** Term vectors contain information about the terms produced by the analysis process. */
 #[derive(Debug, Clone, Copy)]
 pub enum TermVector {
-    /** No term vectors are stored. (default) */ No,
-    /** Just the terms in the field are stored. */ Yes,
-    /** Terms and positions are stored. */ WithPositions,
-    /** Terms and character offsets are stored. */ WithOffsets,
-    /** Terms, positions, and character offsets are stored. */ WithPositionsOffsets,
+    /** No term vectors are stored. (default) */
+    No,
+    /** Just the terms in the field are stored. */
+    Yes,
+    /** Terms and positions are stored. */
+    WithPositions,
+    /** Terms and character offsets are stored. */
+    WithOffsets,
+    /** Terms, positions, and character offsets are stored. */
+    WithPositionsOffsets,
 }
 
 impl Serialize for TermVector {
@@ -267,9 +278,12 @@ impl Serialize for TermVector {
 /** Fielddata for term frequency as a percentage range. */
 #[derive(Debug, Default, PartialEq, Clone, Copy)]
 pub struct FieldDataFrequencyFilter {
-    /** The min frequency percentage. */ pub min: Option<f32>,
-    /** The max frequency percentage. */ pub max: Option<f32>,
-    /** The minimum number of docs a segment should contain. */ pub min_segment_size: Option<i32>,
+    /** The min frequency percentage. */
+    pub min: Option<f32>,
+    /** The max frequency percentage. */
+    pub max: Option<f32>,
+    /** The minimum number of docs a segment should contain. */
+    pub min_segment_size: Option<i32>,
 }
 
 impl Serialize for FieldDataFrequencyFilter {
@@ -324,9 +338,12 @@ pub struct TextFieldMapping {
     Any characters over this length will be ignored.
     */
     pub ignore_above: Option<u32>,
-    /** Should the field be searchable? Accepts `true` (default) or `false`. */ pub index: Option<bool>,
-    /** What information should be stored in the index, for search and highlighting purposes. Defaults to `Positions`. */ pub index_options: Option<IndexOptions>,
-    /** Whether field-length should be taken into account when scoring queries. Accepts `true` (default) or `false`. */ pub norms: Option<bool>,
+    /** Should the field be searchable? Accepts `true` (default) or `false`. */
+    pub index: Option<bool>,
+    /** What information should be stored in the index, for search and highlighting purposes. Defaults to `Positions`. */
+    pub index_options: Option<IndexOptions>,
+    /** Whether field-length should be taken into account when scoring queries. Accepts `true` (default) or `false`. */
+    pub norms: Option<bool>,
     /**
     The number of fake term position which should be inserted between each element of an array of strings.
     Defaults to the `position_increment_gap` configured on the analyzer which defaults to `100`.
@@ -395,10 +412,21 @@ impl Serialize for TextFieldMapping {
 }
 
 mod private {
-    use serde::{Serialize, Serializer};
+    use super::{
+        TextFieldType,
+        TextMapping,
+    };
+    use private::field::{
+        FieldMapping,
+        FieldType,
+        SerializeFieldMapping,
+        StaticSerialize,
+    };
     use serde::ser::SerializeStruct;
-    use private::field::{StaticSerialize, SerializeFieldMapping, FieldMapping, FieldType};
-    use super::{TextFieldType, TextMapping};
+    use serde::{
+        Serialize,
+        Serializer,
+    };
 
     #[derive(Default)]
     pub struct TextPivot;
diff --git a/src/types/src/string/text/mod.rs b/src/types/src/string/text/mod.rs
index 230af5414c..e7cfa7212f 100644
--- a/src/types/src/string/text/mod.rs
+++ b/src/types/src/string/text/mod.rs
@@ -13,7 +13,7 @@ pub use self::impls::*;
 pub mod prelude {
     /*!
     Includes all types for the `text` type.
-    
+
     This is a convenience module to make it easy to build mappings for multiple types without too many `use` statements.
     */
 
diff --git a/src/types_derive/src/lib.rs b/src/types_derive/src/lib.rs
index 006aeceed6..4b282e5c9e 100644
--- a/src/types_derive/src/lib.rs
+++ b/src/types_derive/src/lib.rs
@@ -1,4 +1,4 @@
-/*! 
+/*!
 Elasticsearch Core Types Codegen
 
  Compile-time code generation for Elasticsearch type implementations.
@@ -15,7 +15,10 @@ extern crate elastic_types_derive_internals as internals;
 extern crate quote;
 extern crate syn;
 
-use internals::{date_format, elastic_type};
+use internals::{
+    date_format,
+    elastic_type,
+};
 
 #[proc_macro_derive(ElasticType, attributes(elastic))]
 pub fn derive_elastic_type(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
diff --git a/src/types_derive_internals/src/date_format/mod.rs b/src/types_derive_internals/src/date_format/mod.rs
index 425e549a76..511121fe3f 100644
--- a/src/types_derive_internals/src/date_format/mod.rs
+++ b/src/types_derive_internals/src/date_format/mod.rs
@@ -3,7 +3,11 @@ use syn;
 
 mod parse;
 
-use super::{get_elastic_meta_items, expect_name_value, get_str_from_lit};
+use super::{
+    expect_name_value,
+    get_elastic_meta_items,
+    get_str_from_lit,
+};
 
 /**
 Derive `DateFormat` for the given input.
@@ -13,7 +17,10 @@ The input must satisfy the following rules:
 - It must be a unit struct.
 - It must have an `#[elastic(date_format="<value>")]` attribute.
 */
-pub fn expand_derive(crate_root: Tokens, input: &syn::MacroInput) -> Result<Vec<Tokens>, DeriveDateFormatError> {
+pub fn expand_derive(
+    crate_root: Tokens,
+    input: &syn::MacroInput,
+) -> Result<Vec<Tokens>, DeriveDateFormatError> {
     // Annotatable item for a unit struct
     match input.body {
         syn::Body::Struct(ref data) => match *data {
@@ -38,7 +45,12 @@ pub fn expand_derive(crate_root: Tokens, input: &syn::MacroInput) -> Result<Vec<
 }
 
 // Implement DateFormat for the type being derived with the mapping
-fn impl_date_format(crate_root: Tokens, item: &syn::MacroInput, name: &str, format: &[Tokens]) -> Tokens {
+fn impl_date_format(
+    crate_root: Tokens,
+    item: &syn::MacroInput,
+    name: &str,
+    format: &[Tokens],
+) -> Tokens {
     let ty = &item.ident;
 
     let parse_fn = quote!(
@@ -77,7 +89,7 @@ fn impl_date_format(crate_root: Tokens, item: &syn::MacroInput, name: &str, form
 // Get the format string supplied by an #[elastic()] attribute
 fn get_format_from_attr<'a>(item: &'a syn::MacroInput) -> Option<String> {
     let val = get_elastic_meta_items(&item.attrs);
-        
+
     let val = val
         .iter()
         .filter_map(|meta| expect_name_value("date_format", &meta))
@@ -89,7 +101,7 @@ fn get_format_from_attr<'a>(item: &'a syn::MacroInput) -> Option<String> {
 // Get the name string supplied by an #[elastic()] attribute
 fn get_name_from_attr<'a>(item: &'a syn::MacroInput) -> Option<String> {
     let val = get_elastic_meta_items(&item.attrs);
-        
+
     let val = val
         .iter()
         .filter_map(|meta| expect_name_value("date_format_name", &meta))
@@ -103,14 +115,30 @@ impl<'a> parse::DateFormatToken<'a> {
         use self::parse::DateFormatToken::*;
 
         match self {
-            Year => quote!(#crate_root::derive::Item::Numeric(#crate_root::derive::Numeric::Year, #crate_root::derive::Pad::Zero)),
-            Month => quote!(#crate_root::derive::Item::Numeric(#crate_root::derive::Numeric::Month, #crate_root::derive::Pad::Zero)),
-            DayOfMonth => quote!(#crate_root::derive::Item::Numeric(#crate_root::derive::Numeric::Day, #crate_root::derive::Pad::Zero)),
-            DayOfYear => quote!(#crate_root::derive::Item::Numeric(#crate_root::derive::Numeric::Ordinal, #crate_root::derive::Pad::Zero)),
-            Hour => quote!(#crate_root::derive::Item::Numeric(#crate_root::derive::Numeric::Hour, #crate_root::derive::Pad::Zero)),
-            Minute => quote!(#crate_root::derive::Item::Numeric(#crate_root::derive::Numeric::Minute, #crate_root::derive::Pad::Zero)),
-            Second => quote!(#crate_root::derive::Item::Numeric(#crate_root::derive::Numeric::Second, #crate_root::derive::Pad::Zero)),
-            Millisecond => quote!(#crate_root::derive::Item::Fixed(#crate_root::derive::Fixed::Nanosecond3)),
+            Year => {
+                quote!(#crate_root::derive::Item::Numeric(#crate_root::derive::Numeric::Year, #crate_root::derive::Pad::Zero))
+            }
+            Month => {
+                quote!(#crate_root::derive::Item::Numeric(#crate_root::derive::Numeric::Month, #crate_root::derive::Pad::Zero))
+            }
+            DayOfMonth => {
+                quote!(#crate_root::derive::Item::Numeric(#crate_root::derive::Numeric::Day, #crate_root::derive::Pad::Zero))
+            }
+            DayOfYear => {
+                quote!(#crate_root::derive::Item::Numeric(#crate_root::derive::Numeric::Ordinal, #crate_root::derive::Pad::Zero))
+            }
+            Hour => {
+                quote!(#crate_root::derive::Item::Numeric(#crate_root::derive::Numeric::Hour, #crate_root::derive::Pad::Zero))
+            }
+            Minute => {
+                quote!(#crate_root::derive::Item::Numeric(#crate_root::derive::Numeric::Minute, #crate_root::derive::Pad::Zero))
+            }
+            Second => {
+                quote!(#crate_root::derive::Item::Numeric(#crate_root::derive::Numeric::Second, #crate_root::derive::Pad::Zero))
+            }
+            Millisecond => {
+                quote!(#crate_root::derive::Item::Fixed(#crate_root::derive::Fixed::Nanosecond3))
+            }
             Utc => quote!(#crate_root::derive::Item::Literal("Z")),
             Delim(s) => quote!(#crate_root::derive::Item::Literal(#s)),
             Escaped(s) => quote!(#crate_root::derive::Item::Literal(#s)),
@@ -118,7 +146,7 @@ impl<'a> parse::DateFormatToken<'a> {
     }
 }
 
-quick_error!{
+quick_error! {
     #[derive(Debug)]
     pub enum DeriveDateFormatError {
         InvalidInput {
diff --git a/src/types_derive_internals/src/date_format/parse.rs b/src/types_derive_internals/src/date_format/parse.rs
index f2a8eac85d..4bca596153 100644
--- a/src/types_derive_internals/src/date_format/parse.rs
+++ b/src/types_derive_internals/src/date_format/parse.rs
@@ -1,5 +1,5 @@
-use std::str;
 use nom::simple_errors::Err as NomError;
+use std::str;
 
 pub type Error = NomError;
 
@@ -139,8 +139,8 @@ named!(escaped(&[u8]) -> DateFormatToken,
 
 #[cfg(test)]
 mod tests {
-    use super::*;
     use self::DateFormatToken::*;
+    use super::*;
 
     fn assert_parse(i: &[u8], expected: Vec<DateFormatToken>) {
         let (_, result) = format(i).unwrap();
diff --git a/src/types_derive_internals/src/elastic_type/mod.rs b/src/types_derive_internals/src/elastic_type/mod.rs
index 8af75eced2..4fa2dbd351 100644
--- a/src/types_derive_internals/src/elastic_type/mod.rs
+++ b/src/types_derive_internals/src/elastic_type/mod.rs
@@ -1,7 +1,17 @@
+use super::{
+    expect_ident,
+    expect_list,
+    expect_name_value,
+    get_elastic_meta_items,
+    get_ident_from_lit,
+    get_tokens_from_lit,
+};
 use quote::Tokens;
+use serde_derive_internals::{
+    self,
+    attr as serde_attr,
+};
 use syn;
-use serde_derive_internals::{self, attr as serde_attr};
-use super::{get_elastic_meta_items, expect_list, expect_name_value, expect_ident, get_ident_from_lit, get_tokens_from_lit};
 
 struct ElasticDocumentMapping {
     ident: syn::Ident,
@@ -19,7 +29,10 @@ The input must satisfy the following rules:
 - A mapping type supplied by `#[elastic(mapping="<ident>")]` must implement `DocumentMapping`,
 but not `PropertiesMapping`.
 */
-pub fn expand_derive(crate_root: Tokens, input: &syn::MacroInput) -> Result<Vec<Tokens>, DeriveElasticTypeError> {
+pub fn expand_derive(
+    crate_root: Tokens,
+    input: &syn::MacroInput,
+) -> Result<Vec<Tokens>, DeriveElasticTypeError> {
     // Annotatable item for a struct with struct fields
     let fields = match input.body {
         syn::Body::Struct(ref data) => match *data {
@@ -41,39 +54,27 @@ pub fn expand_derive(crate_root: Tokens, input: &syn::MacroInput) -> Result<Vec<
 
     let mapping = get_mapping(&crate_root, input);
 
-    let doc_ty_impl_block = get_doc_ty_impl_block(
-        &crate_root,
-        input,
-        &fields,
-        &mapping.ident,
-    );
+    let doc_ty_impl_block = get_doc_ty_impl_block(&crate_root, input, &fields, &mapping.ident);
 
-
-    let props_impl_block = get_props_impl_block(
-        &crate_root,
-        &input.ident,
-        &fields,
-    );
+    let props_impl_block = get_props_impl_block(&crate_root, &input.ident, &fields);
 
     let dummy_wrapper = syn::Ident::new(format!("_IMPL_EASTIC_TYPE_FOR_{}", input.ident));
 
     let mapping_definition = &mapping.definition;
     let mapping_impl_block = &mapping.impl_block;
 
-    Ok(vec![
-        quote!(
+    Ok(vec![quote!(
         #mapping_definition
 
         #[allow(non_upper_case_globals, dead_code, unused_variables)]
-        const #dummy_wrapper: () = {            
+        const #dummy_wrapper: () = {
             #mapping_impl_block
 
             #doc_ty_impl_block
 
             #props_impl_block
         };
-    ),
-    ])
+    )])
 }
 
 fn get_mapping(crate_root: &Tokens, input: &syn::MacroInput) -> ElasticDocumentMapping {
@@ -93,7 +94,7 @@ fn get_mapping(crate_root: &Tokens, input: &syn::MacroInput) -> ElasticDocumentM
     // Get the mapping ident supplied by an #[elastic()] attribute or create a default one
     fn get_mapping_from_attr(item: &syn::MacroInput) -> Option<syn::Ident> {
         let val = get_elastic_meta_items(&item.attrs);
-            
+
         let val = val
             .iter()
             .filter_map(|meta| expect_name_value("mapping", &meta))
@@ -103,7 +104,11 @@ fn get_mapping(crate_root: &Tokens, input: &syn::MacroInput) -> ElasticDocumentM
     }
 
     // Implement DocumentMapping for the mapping
-    fn impl_document_mapping(crate_root: &Tokens, mapping: &syn::Ident, properties: &syn::Ident) -> Tokens {
+    fn impl_document_mapping(
+        crate_root: &Tokens,
+        mapping: &syn::Ident,
+        properties: &syn::Ident,
+    ) -> Tokens {
         quote!(
             impl #crate_root::derive::ObjectMapping for #mapping {
                 type Properties = #properties;
@@ -135,8 +140,8 @@ fn get_doc_ty_impl_block(
     crate_root: &Tokens,
     item: &syn::MacroInput,
     fields: &[(syn::Ident, &syn::Field)],
-    mapping: &syn::Ident)
--> Tokens {
+    mapping: &syn::Ident,
+) -> Tokens {
     struct MetadataBlock {
         instance_methods: Tokens,
         static_impls: Tokens,
@@ -146,8 +151,8 @@ fn get_doc_ty_impl_block(
     fn get_doc_ty_methods(
         crate_root: &Tokens,
         item: &syn::MacroInput,
-        fields: &[(syn::Ident, &syn::Field)])
-    -> MetadataBlock {
+        fields: &[(syn::Ident, &syn::Field)],
+    ) -> MetadataBlock {
         struct ElasticMetadataMethods {
             index: Tokens,
             index_is_static: bool,
@@ -157,7 +162,10 @@ fn get_doc_ty_impl_block(
         }
 
         // Get the default method blocks for `DocumentType`
-        fn get_doc_type_methods(item: &syn::MacroInput, fields: &[(syn::Ident, &syn::Field)]) -> ElasticMetadataMethods {
+        fn get_doc_type_methods(
+            item: &syn::MacroInput,
+            fields: &[(syn::Ident, &syn::Field)],
+        ) -> ElasticMetadataMethods {
             // Get the default name for the indexed elasticsearch type name
             fn get_elastic_type_name(item: &syn::MacroInput) -> syn::Lit {
                 syn::Lit::Str(
@@ -173,7 +181,7 @@ fn get_doc_ty_impl_block(
                     _ => {
                         let name = get_elastic_type_name(item);
                         (quote!(#name), true)
-                    },
+                    }
                 }
             };
 
@@ -188,15 +196,15 @@ fn get_doc_ty_impl_block(
             let id = get_method_from_struct(item, "id")
                 .map(|id_expr| match id_expr {
                     MethodFromStruct::Expr(method) => quote!(#method (self)),
-                    _ => panic!("id attributes on a struct definition must be of the form #[id(expr = \"expression\")]"),                    
+                    _ => panic!("id attributes on a struct definition must be of the form #[id(expr = \"expression\")]"),
                 })
-                .or_else(|| get_method_from_fields(fields, "id").map(|field| {
-                    match field {
+                .or_else(|| {
+                    get_method_from_fields(fields, "id").map(|field| match field {
                         MethodFromField::Field(field) => quote!(&self . #field),
                         MethodFromField::Expr(field, method) => quote!(#method (&self . #field)),
-                        _ => panic!("id attributes on a field must be of the form #[id] or #[id(expr = \"expression\")]")
-                    }
-                }))
+                        _ => panic!("id attributes on a field must be of the form #[id] or #[id(expr = \"expression\")]"),
+                    })
+                })
                 .map(|id_expr| quote!(Some((#id_expr).into())))
                 .unwrap_or_else(|| quote!(None));
 
@@ -247,7 +255,7 @@ fn get_doc_ty_impl_block(
                     Some(#ty)
                 }
             );
-            
+
             let block = quote!(
                 impl #crate_root::derive::StaticType for #doc_ty { }
             );
@@ -287,13 +295,16 @@ fn get_doc_ty_impl_block(
                 #static_index_block
 
                 #static_ty_block
-            )
+            ),
         }
     }
 
     let doc_ty = &item.ident;
 
-    let MetadataBlock { instance_methods, static_impls } = get_doc_ty_methods(crate_root, item, fields);
+    let MetadataBlock {
+        instance_methods,
+        static_impls,
+    } = get_doc_ty_methods(crate_root, item, fields);
 
     quote!(
         impl #crate_root::derive::ObjectFieldType for #doc_ty {
@@ -312,10 +323,13 @@ fn get_doc_ty_impl_block(
 fn get_props_impl_block(
     crate_root: &Tokens,
     props_ty: &syn::Ident,
-    fields: &[(syn::Ident, &syn::Field)])
--> Tokens {
+    fields: &[(syn::Ident, &syn::Field)],
+) -> Tokens {
     // Get the serde serialisation statements for each of the fields on the type being derived
-    fn get_field_ser_stmts(crate_root: &Tokens, fields: &[(syn::Ident, &syn::Field)]) -> Vec<Tokens> {
+    fn get_field_ser_stmts(
+        crate_root: &Tokens,
+        fields: &[(syn::Ident, &syn::Field)],
+    ) -> Vec<Tokens> {
         let fields: Vec<Tokens> = fields
             .iter()
             .cloned()
@@ -338,7 +352,7 @@ fn get_props_impl_block(
         impl #crate_root::derive::PropertiesMapping for #props_ty {
             fn props_len() -> usize { #stmts_len }
 
-            fn serialize_props<S>(state: &mut S) -> ::std::result::Result<(), S::Error> 
+            fn serialize_props<S>(state: &mut S) -> ::std::result::Result<(), S::Error>
                 where S: #crate_root::derive::SerializeStruct {
                 #(#stmts)*
                 Ok(())
@@ -393,14 +407,14 @@ enum MethodFromField {
 // Parses #[elastic(method(expr = $expr))]
 fn get_method_from_struct(item: &syn::MacroInput, method: &str) -> Option<MethodFromStruct> {
     let val = get_elastic_meta_items(&item.attrs);
-    
-    // Attempt to get a literal 
+
+    // Attempt to get a literal
     if let Some(lit) = val
         .iter()
         .filter_map(|meta| expect_name_value(method, meta))
         .next()
     {
-        return Some(MethodFromStruct::Literal(quote!(#lit)))
+        return Some(MethodFromStruct::Literal(quote!(#lit)));
     }
 
     if let Some(expr) = val
@@ -411,34 +425,32 @@ fn get_method_from_struct(item: &syn::MacroInput, method: &str) -> Option<Method
         .next()
         .and_then(|expr| get_tokens_from_lit(expr).ok())
     {
-        return Some(MethodFromStruct::Expr(quote!(#expr)))
+        return Some(MethodFromStruct::Expr(quote!(#expr)));
     }
 
     None
 }
 
-fn get_method_from_fields(fields: &[(syn::Ident, &syn::Field)], method: &str) -> Option<MethodFromField> {
+fn get_method_from_fields(
+    fields: &[(syn::Ident, &syn::Field)],
+    method: &str,
+) -> Option<MethodFromField> {
     for &(_, ref field) in fields {
         let val = get_elastic_meta_items(&field.attrs);
         let field = &field.ident;
 
         // Return the field name for `#[method]`
-        if val
-            .iter()
-            .any(|meta| {
-                expect_ident(method, meta)
-            })
-        {
+        if val.iter().any(|meta| expect_ident(method, meta)) {
             return Some(MethodFromField::Field(quote!(#field)));
         }
-    
+
         // Return the literal value for `#[method = literal]`
         if let Some(lit) = val
             .iter()
             .filter_map(|meta| expect_name_value(method, meta))
             .next()
         {
-            return Some(MethodFromField::Literal(quote!(#field), quote!(#lit)))
+            return Some(MethodFromField::Literal(quote!(#field), quote!(#lit)));
         }
 
         // Return the expr value for `#[method(expr = expr)]`
@@ -450,7 +462,7 @@ fn get_method_from_fields(fields: &[(syn::Ident, &syn::Field)], method: &str) ->
             .next()
             .and_then(|expr| get_tokens_from_lit(expr).ok())
         {
-            return Some(MethodFromField::Expr(quote!(#field), quote!(#expr)))
+            return Some(MethodFromField::Expr(quote!(#field), quote!(#expr)));
         }
     }
 
diff --git a/src/types_derive_internals/src/lib.rs b/src/types_derive_internals/src/lib.rs
index 6aa8401c5b..de65fd3ba0 100644
--- a/src/types_derive_internals/src/lib.rs
+++ b/src/types_derive_internals/src/lib.rs
@@ -1,4 +1,4 @@
-/*! 
+/*!
 Elasticsearch Core Types Codegen
 
 This crate contains the internals for `elastic_types`-related codegen.
@@ -22,8 +22,8 @@ extern crate serde_json;
 
 extern crate chrono;
 
-pub mod elastic_type;
 pub mod date_format;
+pub mod elastic_type;
 
 fn get_elastic_meta_items<'a, I>(attrs: I) -> Vec<syn::NestedMetaItem>
 where
@@ -42,14 +42,23 @@ where
 
 fn expect_name_value<'a>(name: &str, meta_item: &'a syn::NestedMetaItem) -> Option<&'a syn::Lit> {
     match *meta_item {
-        syn::NestedMetaItem::MetaItem(syn::MetaItem::NameValue(ref key, ref lit)) if key == name => Some(lit),
+        syn::NestedMetaItem::MetaItem(syn::MetaItem::NameValue(ref key, ref lit))
+            if key == name =>
+        {
+            Some(lit)
+        }
         _ => None,
     }
 }
 
-fn expect_list<'a>(name: &str, meta_item: &'a syn::NestedMetaItem) -> Option<&'a [syn::NestedMetaItem]> {
+fn expect_list<'a>(
+    name: &str,
+    meta_item: &'a syn::NestedMetaItem,
+) -> Option<&'a [syn::NestedMetaItem]> {
     match *meta_item {
-        syn::NestedMetaItem::MetaItem(syn::MetaItem::List(ref key, ref list)) if key == name => Some(list),
+        syn::NestedMetaItem::MetaItem(syn::MetaItem::List(ref key, ref list)) if key == name => {
+            Some(list)
+        }
         _ => None,
     }
 }


Test patch:
diff --git a/src/queries/tests/mod.rs b/src/queries/tests/mod.rs
index 72cc91ddef..040af939d8 100644
--- a/src/queries/tests/mod.rs
+++ b/src/queries/tests/mod.rs
@@ -3,8 +3,6 @@ extern crate serde_json;
 
 use elastic_queries::prelude::*;
 
-
-
 #[test]
 fn aggregation_search() {
     let j = include_str!("complex.json");
diff --git a/src/responses/tests/bulk/mod.rs b/src/responses/tests/bulk/mod.rs
index 09dbe0112e..b76a07acf6 100644
--- a/src/responses/tests/bulk/mod.rs
+++ b/src/responses/tests/bulk/mod.rs
@@ -1,14 +1,16 @@
 extern crate elastic_responses;
 extern crate serde_json;
 
-use elastic_responses::*;
 use elastic_responses::error::*;
+use elastic_responses::*;
 use load_file;
 
 #[test]
 fn success_parse_index_ops() {
     let f = load_file("tests/samples/bulk_index.json");
-    let deserialized = parse::<BulkResponse>().from_reader(StatusCode::OK, f).unwrap();
+    let deserialized = parse::<BulkResponse>()
+        .from_reader(StatusCode::OK, f)
+        .unwrap();
 
     assert!(deserialized.is_ok());
 
@@ -19,7 +21,9 @@ fn success_parse_index_ops() {
 #[test]
 fn success_parse_index_ops_errors_only() {
     let f = load_file("tests/samples/bulk_index.json");
-    let deserialized = parse::<BulkErrorsResponse>().from_reader(StatusCode::OK, f).unwrap();
+    let deserialized = parse::<BulkErrorsResponse>()
+        .from_reader(StatusCode::OK, f)
+        .unwrap();
 
     assert!(deserialized.is_ok());
     assert_eq!(0, deserialized.iter().count());
@@ -28,7 +32,9 @@ fn success_parse_index_ops_errors_only() {
 #[test]
 fn success_parse_multi_ops() {
     let f = load_file("tests/samples/bulk_multiple_ops.json");
-    let deserialized = parse::<BulkResponse>().from_reader(StatusCode::OK, f).unwrap();
+    let deserialized = parse::<BulkResponse>()
+        .from_reader(StatusCode::OK, f)
+        .unwrap();
 
     assert!(deserialized.is_ok());
 
@@ -55,7 +61,9 @@ fn success_parse_multi_ops() {
 #[test]
 fn success_parse_multi_ops_errors_only() {
     let f = load_file("tests/samples/bulk_multiple_ops.json");
-    let deserialized = parse::<BulkErrorsResponse>().from_reader(StatusCode::OK, f).unwrap();
+    let deserialized = parse::<BulkErrorsResponse>()
+        .from_reader(StatusCode::OK, f)
+        .unwrap();
 
     assert!(deserialized.is_ok());
     assert_eq!(0, deserialized.iter().count());
@@ -64,7 +72,9 @@ fn success_parse_multi_ops_errors_only() {
 #[test]
 fn success_parse_with_errors() {
     let f = load_file("tests/samples/bulk_error.json");
-    let deserialized = parse::<BulkResponse>().from_reader(StatusCode::OK, f).unwrap();
+    let deserialized = parse::<BulkResponse>()
+        .from_reader(StatusCode::OK, f)
+        .unwrap();
 
     assert!(deserialized.is_err());
 
@@ -75,7 +85,9 @@ fn success_parse_with_errors() {
 #[test]
 fn success_parse_with_errors_errors_only() {
     let f = load_file("tests/samples/bulk_error.json");
-    let deserialized = parse::<BulkErrorsResponse>().from_reader(StatusCode::OK, f).unwrap();
+    let deserialized = parse::<BulkErrorsResponse>()
+        .from_reader(StatusCode::OK, f)
+        .unwrap();
 
     assert!(deserialized.is_err());
 
@@ -85,10 +97,16 @@ fn success_parse_with_errors_errors_only() {
 #[test]
 fn error_parse_action_request_validation() {
     let f = load_file("tests/samples/error_action_request_validation.json");
-    let deserialized = parse::<BulkResponse>().from_reader(StatusCode::BAD_REQUEST, f).unwrap_err();
+    let deserialized = parse::<BulkResponse>()
+        .from_reader(StatusCode::BAD_REQUEST, f)
+        .unwrap_err();
 
     let valid = match deserialized {
-        ResponseError::Api(ApiError::ActionRequestValidation { ref reason }) if reason == "Validation Failed: 1: index is missing;2: type is missing;" => true,
+        ResponseError::Api(ApiError::ActionRequestValidation { ref reason })
+            if reason == "Validation Failed: 1: index is missing;2: type is missing;" =>
+        {
+            true
+        }
         _ => false,
     };
 
@@ -103,7 +121,11 @@ fn error_parse_action_request_validation_errors_only() {
         .unwrap_err();
 
     let valid = match deserialized {
-        ResponseError::Api(ApiError::ActionRequestValidation { ref reason }) if reason == "Validation Failed: 1: index is missing;2: type is missing;" => true,
+        ResponseError::Api(ApiError::ActionRequestValidation { ref reason })
+            if reason == "Validation Failed: 1: index is missing;2: type is missing;" =>
+        {
+            true
+        }
         _ => false,
     };
 
diff --git a/src/responses/tests/command/mod.rs b/src/responses/tests/command/mod.rs
index 6dbbf2f9c6..89bd07be94 100644
--- a/src/responses/tests/command/mod.rs
+++ b/src/responses/tests/command/mod.rs
@@ -7,7 +7,9 @@ use load_file;
 #[test]
 fn success_parse_command_response() {
     let f = load_file("tests/samples/acknowledged.json");
-    let deserialized = parse::<CommandResponse>().from_reader(StatusCode::OK, f).unwrap();
+    let deserialized = parse::<CommandResponse>()
+        .from_reader(StatusCode::OK, f)
+        .unwrap();
 
     assert!(deserialized.acknowledged());
 }
diff --git a/src/responses/tests/get/mod.rs b/src/responses/tests/get/mod.rs
index baebe60591..da34134ec3 100644
--- a/src/responses/tests/get/mod.rs
+++ b/src/responses/tests/get/mod.rs
@@ -1,15 +1,17 @@
 extern crate elastic_responses;
 extern crate serde_json;
 
-use serde_json::Value;
-use elastic_responses::*;
 use elastic_responses::error::*;
+use elastic_responses::*;
 use load_file;
+use serde_json::Value;
 
 #[test]
 fn success_parse_found_doc_response() {
     let f = load_file("tests/samples/get_found.json");
-    let deserialized = parse::<GetResponse<Value>>().from_reader(StatusCode::OK, f).unwrap();
+    let deserialized = parse::<GetResponse<Value>>()
+        .from_reader(StatusCode::OK, f)
+        .unwrap();
 
     assert_eq!("testindex", deserialized.index());
     assert_eq!("testtype", deserialized.ty());
@@ -23,11 +25,14 @@ fn success_parse_found_doc_response() {
 #[test]
 fn success_into_document() {
     let f = load_file("tests/samples/get_found.json");
-    let deserialized = parse::<GetResponse<Value>>().from_reader(StatusCode::OK, f).unwrap();
+    let deserialized = parse::<GetResponse<Value>>()
+        .from_reader(StatusCode::OK, f)
+        .unwrap();
 
     match deserialized.into_document() {
         Some(doc) => {
-            let id = doc.as_object()
+            let id = doc
+                .as_object()
                 .and_then(|src| src.get("id"))
                 .and_then(|id| id.as_u64());
 
@@ -40,7 +45,9 @@ fn success_into_document() {
 #[test]
 fn success_parse_not_found_doc_response() {
     let f = load_file("tests/samples/get_not_found.json");
-    let deserialized = parse::<GetResponse<Value>>().from_reader(StatusCode::NOT_FOUND, f).unwrap();
+    let deserialized = parse::<GetResponse<Value>>()
+        .from_reader(StatusCode::NOT_FOUND, f)
+        .unwrap();
 
     assert!(!deserialized.found());
     assert!(deserialized.into_document().is_none());
diff --git a/src/responses/tests/index/mod.rs b/src/responses/tests/index/mod.rs
index 30100c022c..b719031232 100644
--- a/src/responses/tests/index/mod.rs
+++ b/src/responses/tests/index/mod.rs
@@ -1,14 +1,16 @@
 extern crate elastic_responses;
 extern crate serde_json;
 
-use elastic_responses::*;
 use elastic_responses::error::*;
+use elastic_responses::*;
 use load_file;
 
 #[test]
 fn success_parse_response() {
     let f = load_file("tests/samples/index_success.json");
-    let deserialized = parse::<IndexResponse>().from_reader(StatusCode::OK, f).unwrap();
+    let deserialized = parse::<IndexResponse>()
+        .from_reader(StatusCode::OK, f)
+        .unwrap();
 
     assert!(deserialized.created());
     assert_eq!("testindex", deserialized.index());
@@ -20,10 +22,14 @@ fn success_parse_response() {
 #[test]
 fn error_parse_index_already_exists() {
     let f = load_file("tests/samples/error_index_already_exists.json");
-    let deserialized = parse::<IndexResponse>().from_reader(StatusCode::BAD_REQUEST, f).unwrap_err();
+    let deserialized = parse::<IndexResponse>()
+        .from_reader(StatusCode::BAD_REQUEST, f)
+        .unwrap_err();
 
     let valid = match deserialized {
-        ResponseError::Api(ApiError::IndexAlreadyExists { ref index }) if index == "carrots" => true,
+        ResponseError::Api(ApiError::IndexAlreadyExists { ref index }) if index == "carrots" => {
+            true
+        }
         _ => false,
     };
 
diff --git a/src/responses/tests/indices_exists/mod.rs b/src/responses/tests/indices_exists/mod.rs
index 243f820ea9..ae82bad6b2 100644
--- a/src/responses/tests/indices_exists/mod.rs
+++ b/src/responses/tests/indices_exists/mod.rs
@@ -5,14 +5,18 @@ use elastic_responses::*;
 
 #[test]
 fn success_parse_response_exists() {
-    let deserialized = parse::<IndicesExistsResponse>().from_slice(StatusCode::OK, b"").unwrap();
+    let deserialized = parse::<IndicesExistsResponse>()
+        .from_slice(StatusCode::OK, b"")
+        .unwrap();
 
     assert!(deserialized.exists());
 }
 
 #[test]
 fn success_parse_response_not_exists() {
-    let deserialized = parse::<IndicesExistsResponse>().from_slice(StatusCode::NOT_FOUND, b"").unwrap();
+    let deserialized = parse::<IndicesExistsResponse>()
+        .from_slice(StatusCode::NOT_FOUND, b"")
+        .unwrap();
 
     assert!(!deserialized.exists());
 }
diff --git a/src/responses/tests/mod.rs b/src/responses/tests/mod.rs
index a8c7f2f2b6..f600f2f4c3 100644
--- a/src/responses/tests/mod.rs
+++ b/src/responses/tests/mod.rs
@@ -10,10 +10,10 @@ fn load_file(p: &str) -> File {
     File::open(p).unwrap()
 }
 
+pub mod bulk;
 pub mod command;
-pub mod ping;
 pub mod get;
-pub mod search;
-pub mod bulk;
 pub mod index;
-pub mod indices_exists;
\ No newline at end of file
+pub mod indices_exists;
+pub mod ping;
+pub mod search;
diff --git a/src/responses/tests/ping/mod.rs b/src/responses/tests/ping/mod.rs
index e8228af050..0f488277f5 100644
--- a/src/responses/tests/ping/mod.rs
+++ b/src/responses/tests/ping/mod.rs
@@ -7,7 +7,9 @@ use load_file;
 #[test]
 fn success_parse_ping_response() {
     let f = load_file("tests/samples/ping_success.json");
-    let deserialized = parse::<PingResponse>().from_reader(StatusCode::OK, f).unwrap();
+    let deserialized = parse::<PingResponse>()
+        .from_reader(StatusCode::OK, f)
+        .unwrap();
 
     assert_eq!("Scorcher", deserialized.name());
 }
diff --git a/src/responses/tests/search/mod.rs b/src/responses/tests/search/mod.rs
index 3b5a40abc5..909532be72 100644
--- a/src/responses/tests/search/mod.rs
+++ b/src/responses/tests/search/mod.rs
@@ -2,10 +2,10 @@ extern crate elastic_responses;
 extern crate serde;
 extern crate serde_json;
 
-use elastic_responses::*;
 use elastic_responses::error::*;
-use serde_json::Value;
+use elastic_responses::*;
 use load_file;
+use serde_json::Value;
 
 #[test]
 fn success_parse_empty() {
@@ -32,17 +32,26 @@ fn success_parse_hits_simple_of_t() {
     #[allow(dead_code)]
     #[derive(Deserialize)]
     struct Event {
-        #[serde(rename = "@version")] version: String,
-        #[serde(rename = "@timestamp")] timestamp: String,
+        #[serde(rename = "@version")]
+        version: String,
+        #[serde(rename = "@timestamp")]
+        timestamp: String,
         port: u16,
-        #[serde(rename = "type")] ty: String,
+        #[serde(rename = "type")]
+        ty: String,
         tags: Vec<String>,
-        #[serde(rename = "destinationAddress")] destination_address: String,
-        #[serde(rename = "countryCode", default)] country_code: String,
-        #[serde(rename = "countryName", default)] country_name: String,
-        #[serde(rename = "cityName", default)] city_name: String,
-        #[serde(rename = "internetServiceProviderName", default)] internet_service_provider_name: String,
-        #[serde(rename = "syslogProgram")] syslog_program: String,
+        #[serde(rename = "destinationAddress")]
+        destination_address: String,
+        #[serde(rename = "countryCode", default)]
+        country_code: String,
+        #[serde(rename = "countryName", default)]
+        country_name: String,
+        #[serde(rename = "cityName", default)]
+        city_name: String,
+        #[serde(rename = "internetServiceProviderName", default)]
+        internet_service_provider_name: String,
+        #[serde(rename = "syslogProgram")]
+        syslog_program: String,
     }
 
     let f = load_file("tests/samples/search_hits_only.json");
diff --git a/tests/run/Cargo.toml b/tests/run/Cargo.toml
index 00e72b87be..e7b38d227e 100644
--- a/tests/run/Cargo.toml
+++ b/tests/run/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "run"
+name = "integration_tests"
 version = "0.1.0"
 authors = ["Ashley Mannix <ashleymannix@live.com.au>"]
 publish = false
@@ -11,10 +11,10 @@ elastic_derive = { version = "*", path = "../../src/elastic_derive" }
 serde = "~1"
 serde_derive = "~1"
 serde_json = "~1"
-futures = "~0.1.16"
-tokio-core = "~0.1.9"
-tokio-timer = "~0.2.1"
-futures-cpupool = "~0.1.6"
-term-painter = "~0.2.4"
-clap = "*"
+futures = "~0.1"
+tokio = "~0.1"
+tokio-threadpool = "~0.1"
+tokio-timer = "~0.2"
+term-painter = "~0.2"
+clap = "~2"
 env_logger = "~0.6"
diff --git a/tests/run/src/build_client.rs b/tests/run/src/build_client.rs
index b532749160..8c2d558c3e 100644
--- a/tests/run/src/build_client.rs
+++ b/tests/run/src/build_client.rs
@@ -1,19 +1,15 @@
-use std::time::Duration;
-use tokio_core::reactor::Handle;
-use futures_cpupool::CpuPool;
 use elastic::prelude::*;
 use elastic::Error;
+use std::time::Duration;
 
-pub fn call(handle: &Handle, run: &str) -> Result<AsyncClient, Error> {
+pub fn call(run: &str) -> Result<AsyncClient, Error> {
     match run {
         // Get a client that sniffs nodes super frequently
         "sniffed_node" => AsyncClientBuilder::new()
-            .sniff_nodes_fluent("http://localhost:9200", |n| {
-                n.wait(Duration::from_secs(1))
-            })
-            .serde_pool(CpuPool::new(4))
-            .build(handle),
+            .sniff_nodes_fluent("http://localhost:9200", |n| n.wait(Duration::from_secs(1)))
+            //.serde_pool(Arc::new(ThreadPool::new()))
+            .build(),
         // Get a default client
-        _ => AsyncClientBuilder::new().build(handle),
+        _ => AsyncClientBuilder::new().build(),
     }
 }
diff --git a/tests/run/src/build_container.rs b/tests/run/src/build_container.rs
index 3084ef993b..eef85e7654 100644
--- a/tests/run/src/build_container.rs
+++ b/tests/run/src/build_container.rs
@@ -1,6 +1,12 @@
 use std::error::Error;
-use std::path::{Path, PathBuf};
-use std::process::{Command, Stdio};
+use std::path::{
+    Path,
+    PathBuf,
+};
+use std::process::{
+    Command,
+    Stdio,
+};
 
 struct Names {
     container_name: String,
@@ -24,7 +30,7 @@ impl Names {
 
 pub fn start(run: &str) -> Result<(), Box<Error>> {
     let names = Names::from_run(run);
-    let containers_path = "./containers";
+    let containers_path = "tests/run/containers";
 
     let mut dockerfile_path = PathBuf::from(containers_path);
     dockerfile_path.push(&names.dockerfile_name);
@@ -43,7 +49,7 @@ pub fn start(run: &str) -> Result<(), Box<Error>> {
                 &names.build_name,
                 ".",
             ])
-            .current_dir("./containers")
+            .current_dir(containers_path)
             .stdout(Stdio::inherit())
             .stderr(Stdio::inherit())
             .output()?;
diff --git a/tests/run/src/bulk/delete.rs b/tests/run/src/bulk/delete.rs
index 7aef51bcf3..587fea1f42 100644
--- a/tests/run/src/bulk/delete.rs
+++ b/tests/run/src/bulk/delete.rs
@@ -1,6 +1,6 @@
-use futures::Future;
-use elastic::prelude::*;
 use elastic::error::Error;
+use elastic::prelude::*;
+use futures::Future;
 use run_tests::IntegrationTest;
 
 #[derive(Debug, Clone, Copy)]
@@ -16,9 +16,7 @@ pub struct Doc {
 const ID: &'static str = "1";
 
 fn doc() -> Doc {
-    Doc {
-        id: ID.to_owned(),
-    }
+    Doc { id: ID.to_owned() }
 }
 
 impl IntegrationTest for Delete {
@@ -33,7 +31,11 @@ impl IntegrationTest for Delete {
 
     // Ensure the index doesn't exist
     fn prepare(&self, client: AsyncClient) -> Box<Future<Item = (), Error = Error>> {
-        let delete_res = client.index(Doc::static_index()).delete().send().map(|_| ());
+        let delete_res = client
+            .index(Doc::static_index())
+            .delete()
+            .send()
+            .map(|_| ());
 
         Box::new(delete_res)
     }
@@ -46,15 +48,9 @@ impl IntegrationTest for Delete {
             .params_fluent(|p| p.url_param("refresh", true))
             .send();
 
-        let delete_res = client
-            .bulk()
-            .push(bulk::<Doc>().delete(ID))
-            .send();
+        let delete_res = client.bulk().push(bulk::<Doc>().delete(ID)).send();
 
-        Box::new(
-            index_res
-                .and_then(|_| delete_res)
-        )
+        Box::new(index_res.and_then(|_| delete_res))
     }
 
     // Ensure the document was found before deleting but not found after deleting
diff --git a/tests/run/src/bulk/index_create.rs b/tests/run/src/bulk/index_create.rs
index 442e38a3ad..f7fffc9aac 100644
--- a/tests/run/src/bulk/index_create.rs
+++ b/tests/run/src/bulk/index_create.rs
@@ -1,6 +1,6 @@
-use futures::Future;
-use elastic::prelude::*;
 use elastic::error::Error;
+use elastic::prelude::*;
+use futures::Future;
 use run_tests::IntegrationTest;
 
 #[derive(Debug, Clone, Copy)]
@@ -44,10 +44,7 @@ impl IntegrationTest for IndexCreate {
 
     // Index a document, then get it
     fn request(&self, client: AsyncClient) -> Box<Future<Item = Self::Response, Error = Error>> {
-        let bulk_res = client
-            .bulk()
-            .push(bulk().create(doc()))
-            .send();
+        let bulk_res = client.bulk().push(bulk().create(doc())).send();
 
         Box::new(bulk_res)
     }
diff --git a/tests/run/src/bulk/mod.rs b/tests/run/src/bulk/mod.rs
index c247d4b53d..8d6c4a4d97 100644
--- a/tests/run/src/bulk/mod.rs
+++ b/tests/run/src/bulk/mod.rs
@@ -1,4 +1,7 @@
-use run_tests::{test, Test};
+use run_tests::{
+    test,
+    Test,
+};
 
 mod delete;
 mod index_create;
diff --git a/tests/run/src/document/compile_test.rs b/tests/run/src/document/compile_test.rs
index c82548efbf..7784063d33 100644
--- a/tests/run/src/document/compile_test.rs
+++ b/tests/run/src/document/compile_test.rs
@@ -1,7 +1,6 @@
 /**
 Tests for ensuring documents can be derived.
 */
-
 use std::collections::HashMap;
 
 #[derive(ElasticType, Serialize, Deserialize)]
diff --git a/tests/run/src/document/delete.rs b/tests/run/src/document/delete.rs
index 1ef7b63294..e6a398ad84 100644
--- a/tests/run/src/document/delete.rs
+++ b/tests/run/src/document/delete.rs
@@ -1,6 +1,6 @@
-use futures::Future;
-use elastic::prelude::*;
 use elastic::error::Error;
+use elastic::prelude::*;
+use futures::Future;
 use run_tests::IntegrationTest;
 
 #[derive(Debug, Clone, Copy)]
@@ -16,9 +16,7 @@ pub struct Doc {
 const ID: &'static str = "1";
 
 fn doc() -> Doc {
-    Doc {
-        id: ID.to_owned(),
-    }
+    Doc { id: ID.to_owned() }
 }
 
 impl IntegrationTest for Delete {
@@ -33,7 +31,11 @@ impl IntegrationTest for Delete {
 
     // Ensure the index doesn't exist
     fn prepare(&self, client: AsyncClient) -> Box<Future<Item = (), Error = Error>> {
-        let delete_res = client.index(Doc::static_index()).delete().send().map(|_| ());
+        let delete_res = client
+            .index(Doc::static_index())
+            .delete()
+            .send()
+            .map(|_| ());
 
         Box::new(delete_res)
     }
diff --git a/tests/run/src/document/mod.rs b/tests/run/src/document/mod.rs
index 8d5009967c..a7ef546133 100644
--- a/tests/run/src/document/mod.rs
+++ b/tests/run/src/document/mod.rs
@@ -1,13 +1,16 @@
-use run_tests::{test, Test};
+use run_tests::{
+    test,
+    Test,
+};
 
 mod compile_test;
 
+mod delete;
 mod simple_index_get;
+mod update_no_index;
 mod update_with_doc;
-mod update_with_script;
 mod update_with_inline_script;
-mod update_no_index;
-mod delete;
+mod update_with_script;
 
 pub fn tests() -> Vec<Test> {
     vec![
diff --git a/tests/run/src/document/simple_index_get.rs b/tests/run/src/document/simple_index_get.rs
index b8678e7a21..1f3611fb2d 100644
--- a/tests/run/src/document/simple_index_get.rs
+++ b/tests/run/src/document/simple_index_get.rs
@@ -1,6 +1,6 @@
-use futures::Future;
-use elastic::prelude::*;
 use elastic::error::Error;
+use elastic::prelude::*;
+use futures::Future;
 use run_tests::IntegrationTest;
 
 #[derive(Debug, Clone, Copy)]
@@ -37,7 +37,11 @@ impl IntegrationTest for SimpleIndexGet {
 
     // Ensure the index doesn't exist
     fn prepare(&self, client: AsyncClient) -> Box<Future<Item = (), Error = Error>> {
-        let delete_res = client.index(Doc::static_index()).delete().send().map(|_| ());
+        let delete_res = client
+            .index(Doc::static_index())
+            .delete()
+            .send()
+            .map(|_| ());
 
         Box::new(delete_res)
     }
diff --git a/tests/run/src/document/update_no_index.rs b/tests/run/src/document/update_no_index.rs
index ba35e4f9a1..8362ca010d 100644
--- a/tests/run/src/document/update_no_index.rs
+++ b/tests/run/src/document/update_no_index.rs
@@ -1,6 +1,9 @@
-use futures::Future;
+use elastic::error::{
+    ApiError,
+    Error,
+};
 use elastic::prelude::*;
-use elastic::error::{ApiError, Error};
+use futures::Future;
 use run_tests::IntegrationTest;
 
 #[derive(Debug, Clone, Copy)]
@@ -25,18 +28,18 @@ impl IntegrationTest for UpdateNoIndex {
 
     // Ensure the index doesn't exist
     fn prepare(&self, client: AsyncClient) -> Box<Future<Item = (), Error = Error>> {
-        let delete_res = client.index(Doc::static_index()).delete().send().map(|_| ());
+        let delete_res = client
+            .index(Doc::static_index())
+            .delete()
+            .send()
+            .map(|_| ());
 
         Box::new(delete_res)
     }
 
     // Execute an update request against that index
     fn request(&self, client: AsyncClient) -> Box<Future<Item = Self::Response, Error = Error>> {
-        let res = client
-            .document::<Doc>()
-            .update("1")
-            .doc(json!({}))
-            .send();
+        let res = client.document::<Doc>().update("1").doc(json!({})).send();
 
         Box::new(res)
     }
diff --git a/tests/run/src/document/update_with_doc.rs b/tests/run/src/document/update_with_doc.rs
index a11c764a41..95c1c15e75 100644
--- a/tests/run/src/document/update_with_doc.rs
+++ b/tests/run/src/document/update_with_doc.rs
@@ -1,6 +1,6 @@
-use futures::Future;
-use elastic::prelude::*;
 use elastic::error::Error;
+use elastic::prelude::*;
+use futures::Future;
 use run_tests::IntegrationTest;
 
 #[derive(Debug, Clone, Copy)]
@@ -36,7 +36,11 @@ impl IntegrationTest for UpdateWithDoc {
 
     // Ensure the index doesn't exist
     fn prepare(&self, client: AsyncClient) -> Box<Future<Item = (), Error = Error>> {
-        let delete_res = client.index(Doc::static_index()).delete().send().map(|_| ());
+        let delete_res = client
+            .index(Doc::static_index())
+            .delete()
+            .send()
+            .map(|_| ());
 
         Box::new(delete_res)
     }
diff --git a/tests/run/src/document/update_with_inline_script.rs b/tests/run/src/document/update_with_inline_script.rs
index 5107d00a22..5fba2ed8bb 100644
--- a/tests/run/src/document/update_with_inline_script.rs
+++ b/tests/run/src/document/update_with_inline_script.rs
@@ -1,6 +1,6 @@
-use futures::Future;
-use elastic::prelude::*;
 use elastic::error::Error;
+use elastic::prelude::*;
+use futures::Future;
 use run_tests::IntegrationTest;
 
 #[derive(Debug, Clone, Copy)]
diff --git a/tests/run/src/document/update_with_script.rs b/tests/run/src/document/update_with_script.rs
index 32d5798c7a..93f49ab418 100644
--- a/tests/run/src/document/update_with_script.rs
+++ b/tests/run/src/document/update_with_script.rs
@@ -1,6 +1,6 @@
-use futures::Future;
-use elastic::prelude::*;
 use elastic::error::Error;
+use elastic::prelude::*;
+use futures::Future;
 use run_tests::IntegrationTest;
 
 #[derive(Debug, Clone, Copy)]
diff --git a/tests/run/src/index/does_not_exist.rs b/tests/run/src/index/does_not_exist.rs
index 688e79615f..ad67e62b3a 100644
--- a/tests/run/src/index/does_not_exist.rs
+++ b/tests/run/src/index/does_not_exist.rs
@@ -1,6 +1,6 @@
-use futures::Future;
-use elastic::prelude::*;
 use elastic::error::Error;
+use elastic::prelude::*;
+use futures::Future;
 use run_tests::IntegrationTest;
 
 #[derive(Debug, Clone, Copy)]
diff --git a/tests/run/src/index/exists.rs b/tests/run/src/index/exists.rs
index 2708343df9..37f42f0fbe 100644
--- a/tests/run/src/index/exists.rs
+++ b/tests/run/src/index/exists.rs
@@ -1,6 +1,6 @@
-use futures::Future;
-use elastic::prelude::*;
 use elastic::error::Error;
+use elastic::prelude::*;
+use futures::Future;
 use run_tests::IntegrationTest;
 
 #[derive(Debug, Clone, Copy)]
diff --git a/tests/run/src/index/mod.rs b/tests/run/src/index/mod.rs
index 9a7d8ce124..4cba953ffe 100644
--- a/tests/run/src/index/mod.rs
+++ b/tests/run/src/index/mod.rs
@@ -1,7 +1,10 @@
-use run_tests::{test, Test};
+use run_tests::{
+    test,
+    Test,
+};
 
-mod exists;
 mod does_not_exist;
+mod exists;
 
 pub fn tests() -> Vec<Test> {
     vec![
diff --git a/tests/run/src/main.rs b/tests/run/src/main.rs
index 0e16562bc2..84f330c487 100644
--- a/tests/run/src/main.rs
+++ b/tests/run/src/main.rs
@@ -12,32 +12,35 @@ extern crate elastic;
 extern crate elastic_derive;
 extern crate env_logger;
 extern crate futures;
-extern crate futures_cpupool;
 extern crate serde;
 #[macro_use]
 extern crate serde_derive;
 #[macro_use]
 extern crate serde_json;
 extern crate term_painter;
-extern crate tokio_core;
+extern crate tokio;
+extern crate tokio_threadpool;
 extern crate tokio_timer;
 
+use clap::{
+    App,
+    Arg,
+};
 use std::process;
-use term_painter::ToStyle;
 use term_painter::Color::*;
-use clap::{App, Arg};
+use term_painter::ToStyle;
 
+mod build_client;
+mod build_container;
 mod bulk;
 mod document;
-mod search;
 mod index;
 mod run_tests;
-mod build_client;
-mod build_container;
+mod search;
 mod wait_until_ready;
 
 fn main() {
-    env_logger::init();
+    env_logger::init_from_env("ELASTIC_LOG");
 
     let matches = App::new("elastic_integration_tests")
         .arg(
@@ -56,18 +59,16 @@ fn main() {
     for run in runs {
         println!("\n{} tests\n", run);
 
-        let mut core = tokio_core::reactor::Core::new().unwrap();
-        let client = build_client::call(&core.handle(), run).unwrap();
+        let client = build_client::call(run).unwrap();
 
         // Build and start a container to run tests against
         build_container::start(run).unwrap();
 
         // Wait until the container is ready
-        core.run(wait_until_ready::call(client.clone(), 60))
-            .unwrap();
+        wait_until_ready::call(client.clone(), 60).unwrap();
 
         // Run the integration tests
-        let results = core.run(run_tests::call(client, 8)).unwrap();
+        let results = run_tests::call(client, 8).unwrap();
         failed.extend(results.iter().filter(|success| **success == false));
         total += results.len();
 
diff --git a/tests/run/src/run_tests.rs b/tests/run/src/run_tests.rs
index d880813eb6..8e06cc5f22 100644
--- a/tests/run/src/run_tests.rs
+++ b/tests/run/src/run_tests.rs
@@ -1,10 +1,17 @@
 use std::fmt::Debug;
 
-use term_painter::ToStyle;
-use term_painter::Color::*;
-use futures::{stream, Future, Stream};
+use elastic::error::{
+    ApiError,
+    Error,
+};
 use elastic::prelude::*;
-use elastic::error::{ApiError, Error};
+use futures::{
+    stream,
+    Future,
+    Stream,
+};
+use term_painter::Color::*;
+use term_painter::ToStyle;
 
 pub type TestResult = bool;
 pub type Test = Box<Fn(AsyncClient) -> Box<Future<Item = TestResult, Error = ()>>>;
@@ -51,7 +58,8 @@ where
     let assert_err_failed = format!("{} unexpected error:", prefix);
     let ok = format!("{} ok", prefix);
 
-    let fut = test.prepare(client.clone())
+    let fut = test
+        .prepare(client.clone())
         .then(move |prep| match prep {
             Err(ref e) if !test.prepare_err(e) => {
                 println!("{} {:?}", Red.bold().paint(prep_failed), e);
@@ -83,11 +91,18 @@ where
     Box::new(fut)
 }
 
-pub fn call(client: AsyncClient, max_concurrent_tests: usize) -> Box<Future<Item = Vec<TestResult>, Error = ()>> {
-    use search;
+pub fn call(client: AsyncClient, max_concurrent_tests: usize) -> Result<Vec<TestResult>, ()> {
+    tokio::runtime::current_thread::block_on_all(call_future(client, max_concurrent_tests))
+}
+
+fn call_future(
+    client: AsyncClient,
+    max_concurrent_tests: usize,
+) -> Box<Future<Item = Vec<TestResult>, Error = ()>> {
+    use bulk;
     use document;
     use index;
-    use bulk;
+    use search;
 
     let document_tests = document::tests().into_iter();
     let search_tests = search::tests().into_iter();
diff --git a/tests/run/src/search/empty_query.rs b/tests/run/src/search/empty_query.rs
index 0d08314f6c..b6f7db5c66 100644
--- a/tests/run/src/search/empty_query.rs
+++ b/tests/run/src/search/empty_query.rs
@@ -1,6 +1,9 @@
-use futures::{future, Future};
-use elastic::prelude::*;
 use elastic::error::Error;
+use elastic::prelude::*;
+use futures::{
+    future,
+    Future,
+};
 use run_tests::IntegrationTest;
 
 #[derive(Debug, Clone, Copy)]
@@ -14,9 +17,7 @@ pub struct Doc {
 }
 
 fn doc() -> Doc {
-    Doc {
-        id: "1".to_owned(),
-    }
+    Doc { id: "1".to_owned() }
 }
 
 impl IntegrationTest for EmptyQuery {
@@ -53,7 +54,8 @@ impl IntegrationTest for EmptyQuery {
 
     // Ensure the response contains documents
     fn assert_ok(&self, res: &Self::Response) -> bool {
-        let correct_hits = res.hits()
+        let correct_hits = res
+            .hits()
             .all(|hit| hit.index() == Doc::static_index() && hit.ty() == Doc::static_ty());
         let len_greater_than_0 = res.documents().count() > 0;
 
diff --git a/tests/run/src/search/mod.rs b/tests/run/src/search/mod.rs
index 98b880bd41..1b972920cf 100644
--- a/tests/run/src/search/mod.rs
+++ b/tests/run/src/search/mod.rs
@@ -1,7 +1,10 @@
-use run_tests::{test, Test};
+use run_tests::{
+    test,
+    Test,
+};
 
-mod no_index;
 mod empty_query;
+mod no_index;
 mod raw_query_string;
 
 pub fn tests() -> Vec<Test> {
diff --git a/tests/run/src/search/no_index.rs b/tests/run/src/search/no_index.rs
index f2ce2d6530..371dabf8ff 100644
--- a/tests/run/src/search/no_index.rs
+++ b/tests/run/src/search/no_index.rs
@@ -1,8 +1,11 @@
-use serde_json::Value;
-use futures::Future;
+use elastic::error::{
+    ApiError,
+    Error,
+};
 use elastic::prelude::*;
-use elastic::error::{ApiError, Error};
+use futures::Future;
 use run_tests::IntegrationTest;
+use serde_json::Value;
 
 #[derive(Debug, Clone, Copy)]
 pub struct NoIndex;
@@ -28,7 +31,7 @@ impl IntegrationTest for NoIndex {
 
     // Execute a search request against that index
     fn request(&self, client: AsyncClient) -> Box<Future<Item = Self::Response, Error = Error>> {
-        let res = client.search().index(INDEX).ty(Some("no_index_ty")).send();
+        let res = client.search().index(INDEX).ty("no_index_ty").send();
 
         Box::new(res)
     }
diff --git a/tests/run/src/search/raw_query_string.rs b/tests/run/src/search/raw_query_string.rs
index a54dab8437..9344aacb19 100644
--- a/tests/run/src/search/raw_query_string.rs
+++ b/tests/run/src/search/raw_query_string.rs
@@ -1,6 +1,9 @@
-use futures::{future, Future};
-use elastic::prelude::*;
 use elastic::error::Error;
+use elastic::prelude::*;
+use futures::{
+    future,
+    Future,
+};
 use run_tests::IntegrationTest;
 
 #[derive(Debug, Clone, Copy)]
@@ -14,9 +17,7 @@ pub struct Doc {
 }
 
 fn doc() -> Doc {
-    Doc {
-        id: "1".to_owned(),
-    }
+    Doc { id: "1".to_owned() }
 }
 
 impl IntegrationTest for RawQueryString {
@@ -63,7 +64,8 @@ impl IntegrationTest for RawQueryString {
 
     // Ensure the response contains documents
     fn assert_ok(&self, res: &Self::Response) -> bool {
-        let correct_hits = res.hits()
+        let correct_hits = res
+            .hits()
             .all(|hit| hit.index() == Doc::static_index() && hit.ty() == Doc::static_ty());
         let len_greater_than_0 = res.documents().count() > 0;
 
diff --git a/tests/run/src/wait_until_ready.rs b/tests/run/src/wait_until_ready.rs
index f1ce88f080..1666bbdf52 100644
--- a/tests/run/src/wait_until_ready.rs
+++ b/tests/run/src/wait_until_ready.rs
@@ -1,55 +1,84 @@
+use elastic::prelude::*;
+use futures::{
+    stream,
+    Future,
+    Stream,
+};
 use std::error::Error as StdError;
-use std::time::{Duration, Instant};
 use std::fmt;
-use tokio_timer::{Deadline, Interval};
-use futures::{stream, Future, Stream};
-use elastic::prelude::*;
-use elastic::Error;
+use std::time::Duration;
 
-#[derive(Clone)]
-struct Ping {
-    client: AsyncClient,
-}
+type Error = Box<StdError>;
 
-impl Ping {
-    fn is_ready(&self) -> Box<Future<Item = bool, Error = Box<StdError>>> {
-        let request = self.client.ping().send().map_err(|e| e.into());
-
-        let check = request.then(|res: Result<PingResponse, Error>| match res {
-            Ok(_) => Ok(true),
-            _ => Ok(false),
-        });
+pub fn call(client: AsyncClient, timeout_secs: u64) -> Result<(), Error> {
+    let wait = tokio::runtime::current_thread::block_on_all(call_future(client, timeout_secs));
 
-        Box::new(check)
+    match wait {
+        Ok(()) | Err(Done::Ready) => Ok(()),
+        Err(Done::Error(e)) => Err(e),
     }
 }
 
-pub fn call(client: AsyncClient, timeout_secs: u64) -> Box<Future<Item = (), Error = Box<StdError>>> {
+fn call_future(client: AsyncClient, timeout_secs: u64) -> Box<Future<Item = (), Error = Done>> {
     println!(
         "waiting up to {}s until the cluster is ready...",
         timeout_secs
     );
 
-    let stream = stream::repeat(Ping { client: client });
+    let stream = stream::unfold(false, move |is_done| {
+        if is_done {
+            None
+        } else {
+            let client = client.clone();
 
-    let wait = Interval::new(Instant::now(), Duration::from_secs(10)).from_err();
+            let poll = tokio_timer::sleep(Duration::from_secs(3))
+                .map_err(Error::from)
+                .and_then(move |_| {
+                    client
+                        .ping()
+                        .send()
+                        .then(|r| {
+                            let r: Result<_, Error> = match r {
+                                Ok(_) => Ok(((), true)),
+                                Err(_) => Ok(((), false)),
+                            };
+
+                            r
+                        })
+                        .map_err(Error::from)
+                });
+
+            Some(poll)
+        }
+    });
 
     let poll = stream
-        .take_while(|ping| ping.is_ready().map(|ready| !ready))
-        .zip(wait)
-        .collect();
+        .fold((), |_, _| {
+            let r: Result<_, Error> = Ok(());
 
-    let poll_or_timeout = Deadline::new(poll, Instant::now() + Duration::from_secs(timeout_secs))
-        .map(|_| ())
-        .map_err(|e| if let Some(e) = e.into_inner() { e } else { Box::new(TimeoutError) });
+            r
+        })
+        // FIXME: This is a super weird hack
+        // The stream seems to never terminate
+        // unless we return an error. My guess
+        // is the runtime attempting to wait on
+        // any remaining futures is never returning.
+        // I'm not too sure why...
+        .then(|r| match r {
+            Ok(_) => Err(Done::Ready),
+            Err(e) => Err(Done::Error(e)),
+        });
 
-    Box::new(poll_or_timeout)
+    Box::new(poll)
 }
 
 #[derive(Debug)]
-struct TimeoutError;
+enum Done {
+    Ready,
+    Error(Error),
+}
 
-impl StdError for TimeoutError {
+impl StdError for Done {
     fn description(&self) -> &str {
         "timeout"
     }
@@ -59,7 +88,7 @@ impl StdError for TimeoutError {
     }
 }
 
-impl fmt::Display for TimeoutError {
+impl fmt::Display for Done {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         write!(f, "timeout")
     }