elastic / elasticsearch-rs

Official Elasticsearch Rust Client
https://www.elastic.co/guide/en/elasticsearch/client/rust-api/current/index.html
Apache License 2.0
702 stars 72 forks source link

[DOCS] Client example documentation #64

Open russcam opened 4 years ago

russcam commented 4 years ago

Each official client has started to implement all of the console examples within the Elasticsearch reference documentation on the master branch, with the aim to port the examples to a future "current" branch once a high number of the doc examples are implemented.

An example of the client doc examples is match query doc page. Switching to C# in a console example shows

image

Client examples should be implemented for the Rust client

Possible implementation

the approach to implementing the YAML rest spec test runner in #19 will likely require access to the ASTs used to generate the client, in order to construct correct client calls in generated test functions. Similarly, the client doc examples would be able to benefit from having access to the ASTs in order to generate correct client examples.

jubyvictor commented 3 years ago

I can take this up if its ok to do so, I'm new to Rust, but have been using ES from 0.9.

russcam commented 3 years ago

@jubyvictor It might be good to hold off on this for now. The reference documentation is undergoing a fairly significant overhaul at the moment, so examples are changing quite frequently. If you're still interested once the reference documentation is in a better position, I can give you a ping. I think it'll be a fair amount of work to implement the general solution

  1. Read collected JSON examples from the alternative_reports.json
  2. Build the client APIs from the REST specs, similar to yaml_test_runner
  3. for each example, build the AST for the client call, and write to a file named <digest>.asciidoc

This should be implemented as a binary, to allow it to be run on demand and as part of a CI process.

jubyvictor commented 3 years ago

Aye aye captain !