Elastic: Elasticsearch Client Update (May 31 2017)


#1

Hi everyone!

I’ve just pushed out a new release for the Elasticsearch client I’ve been working on. It’s been a solid month’s worth of effort so I’m excited to get it out the door.

This release basically overhauls the whole API and adds some simple builders that can be used to configure requests. So now we can do this:

let response = client.search::<MyType>()
                     .index("myindex")
                     .params(|p| p.url_param("pretty", true))
                     .send()?;

Instead of what we did before:

let response: SearchResponse<Value> = client.request(SearchRequest::for_index_ty("myindex", "mytype", empty_body())
                                            .params(|p| p.url_param("pretty", true))
                                            .send()?
                                            .into_response()?;

I’ve only implemented a few endpoints as builders and don’t plan to add builder methods for the Query DSL itself like rs-es does, but the idea is definitely to evolve them and add more endpoints over time. I also want to make Client.request without builders as ergonomic as possible, it shouldn’t be a second-class API.

Up next I plan to flesh out the document types, make sure everything is looking good for Elasticsearch 6.0, and use the API Guidelines to get everything in a tidier shape.

If anyone has any feedback I’d be keen to hear it! :slight_smile: