Describe the bugThe documentation describes using the .and_then() method for getting a response object from Elastic, but this method doesn't seem to work as described.
Error message:
error[E0599]: no method named `and_then` found for struct `elastic::client::requests::document_index::Pending` in the current scope
--> src/main.rs:26:6
|
26 | .and_then(|response| response.into_response::<IndexResponse<Value>>());
| ^^^^^^^^ method not found in `elastic::client::requests::document_index::Pending`
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
1 | use futures::future::Future;
|
To Reproduce
use elastic;
use elastic::client::responses::IndexResponse;
use futures::future::Future;
use serde::Serialize;
use serde_json::Value;
#[derive(Serialize)]
struct Stats {
pub field: String,
}
fn main() {
let elastic = elastic::client::AsyncClientBuilder::new()
.static_nodes(vec!["localhost"])
.build()
.unwrap();
let stats = Stats {
field: "foo".to_string(),
};
let index_name = "searches";
let es_response = elastic
.document()
.index_raw(index_name, stats)
.send()
.and_then(|response| response.into_response::<IndexResponse<Value>>());
}
Expected behavior
The .and_then() method should be available as documented.
Environment (please complete the following information):
Describe the bug The documentation describes using the
.and_then()
method for getting a response object from Elastic, but this method doesn't seem to work as described.Error message:
To Reproduce
Expected behavior The
.and_then()
method should be available as documented.Environment (please complete the following information):
Additional context
Cargo.toml
: