Skip to content

Commit f51f513

Browse files
committed
Add params directory and module
This commit adds a params directory and module, to allow for documenting the generated params enums.
1 parent 0d1ebd8 commit f51f513

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

elasticsearch/src/lib.rs

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Official Rust client for [Elasticsearch](https://www.elastic.co/products/elasticsearch)
22
//!
3-
//! `Elasticsearch` is the Official Rust client for Elasticsearch, providing an efficient and easy
4-
//! to use asynchronous client for all stable Elasticsearch APIs.
3+
//! `Elasticsearch` is an official Rust client for Elasticsearch, providing an efficient asynchronous
4+
//! client for all stable Elasticsearch APIs that's easy to use.
55
//!
66
//! # Versions and Compatibility
77
//!
@@ -25,13 +25,13 @@
2525
//! Elasticsearch 7.5.0+, but for all other APIs available in Elasticsearch, the respective API
2626
//! functions on the client will be compatible.
2727
//!
28-
//! **No compatibility assurances are given** between different major versions of the client and
29-
//! Elasticsearch. Major differences likely exist between major versions of Elasticsearch, particularly
28+
//! **No compatibility assurances are given between different major versions of the client and
29+
//! Elasticsearch**. Major differences likely exist between major versions of Elasticsearch, particularly
3030
//! around request and response object formats, but also around API urls and behaviour.
3131
//!
3232
//! # Getting started
3333
//!
34-
//! Add the crate name and version to Cargo.toml. Choose the version that is compatible with
34+
//! Add the `elasticsearch` crate and version to Cargo.toml. Choose the version that is compatible with
3535
//! the version of Elasticsearch you're using
3636
//!
3737
//! ```toml,no_run
@@ -57,7 +57,7 @@
5757
//! # Ok(())
5858
//! # }
5959
//! ```
60-
//! You can create a client to make API calls against Elasticsearch running on a
60+
//! Alternatively, you can create a client to make API calls against Elasticsearch running on a
6161
//! specific [url::Url]
6262
//!
6363
//! ```rust,no_run
@@ -92,9 +92,9 @@
9292
//! # }
9393
//! ```
9494
//!
95-
//! More control over how a [Transport](http::transport::Transport) is configured can be
96-
//! achieved using [TransportBuilder](http::transport::TransportBuilder) to build a transport and
97-
//! passing it to create a new instance of [Elasticsearch]
95+
//! More control over how a [Transport](http::transport::Transport) is built can be
96+
//! achieved using [TransportBuilder](http::transport::TransportBuilder) to build a transport, and
97+
//! passing it to [Elasticsearch::new] create a new instance of [Elasticsearch]
9898
//!
9999
//! ```rust,no_run
100100
//! # use elasticsearch;
@@ -115,8 +115,11 @@
115115
//! ## Making API calls
116116
//!
117117
//! The client exposes all stable Elasticsearch APIs, either on the root [Elasticsearch] client,
118-
//! or on a _namespace_ client such as [Cat](cat::Cat), that groups related APIs. All API functions
119-
//! are `async` and can be `await`ed
118+
//! or on a _namespace_ client that groups related APIs, such as [Cat](cat::Cat), which groups the
119+
//! Cat related APIs. All API functions are `async` and can be `await`ed.
120+
//!
121+
//! The following makes an API call to `tweets/_search` with the json body
122+
//! `{"query":{"match":{"message":"Elasticsearch"}}}`
120123
//!
121124
//! ```rust,no_run
122125
//! # use elasticsearch;
@@ -145,7 +148,9 @@
145148
//! # Ok(())
146149
//! # }
147150
//! ```
148-
//!
151+
//! For APIs that contain parts of the Url path to be provided by the consumer, the Url path
152+
//! variants are modelled as an `enum`, such as [SearchParts] in the above example, which models
153+
//! the variants of the [Search] API.
149154
//!
150155
151156
// also test examples in README
@@ -177,6 +182,7 @@ pub mod license;
177182
pub mod migration;
178183
pub mod ml;
179184
pub mod nodes;
185+
pub mod params;
180186
pub mod security;
181187
pub mod slm;
182188
pub mod snapshot;
@@ -192,7 +198,7 @@ mod generated;
192198

193199
// exposes types within modules at the library root level
194200
pub use crate::{
195-
client::*, error::*, generated::params, generated::root::*,
201+
client::*, error::*, generated::root::*,
196202
http::transport::DEFAULT_ADDRESS,
197203
};
198204

elasticsearch/src/params/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//! API parameters
2+
3+
pub use super::generated::params::*;
4+

0 commit comments

Comments
 (0)