[DOCS] add docs for REST high level client index method#25501
[DOCS] add docs for REST high level client index method#25501javanna merged 2 commits intoelastic:masterfrom
Conversation
This commit restructures the existing high level client docs, adapts the existing delete method docs and adds docs for the index method.
| import java.util.Map; | ||
|
|
||
| /** | ||
| * This class is used to generate the Java Delete API documentation. |
| * Then in the documentation, you can extract what is between tag and end tags with | ||
| * ["source","java",subs="attributes,callouts"] | ||
| * -------------------------------------------------- | ||
| * sys2::[perl -ne 'exit if /end::example/; print if $tag; $tag = $tag || /tag::example/' \ |
There was a problem hiding this comment.
I believe this text is out of date now that we have a macro.
| { | ||
| //tag::index-request-map | ||
| Map<String, Object> jsonMap = new HashMap<>(); | ||
| jsonMap.put("user","kimchy"); |
| .source(jsonMap); // <1> | ||
| //end::index-request-map | ||
| IndexResponse indexResponse = client.index(indexRequest); | ||
| assertEquals(indexResponse.getResult(), DocWriteResponse.Result.CREATED); |
There was a problem hiding this comment.
I wonder if it'd be nice to have the assertion in the docs with a note about how this is the response. And maybe a note that you don't have to assert anything if you don't care whether or not it was created up updated because non-200s throw exceptions.
There was a problem hiding this comment.
Actually, is that true about the non-200s? It is with the low level client.
There was a problem hiding this comment.
And it looks like you cover the response below. So you can ignore this.
There was a problem hiding this comment.
it's a good question. I'm not incredibly happy yet with what I have, but here is my thinking: I want to have some assertions, just to make sure that things really work the way we document them. Yet, I think assertions are confusing if they are made part of the docs. As a result, the docs that get published contain some ifs without instructions etc. which are not nice, but it is really up to users what to do from there...
| IndexRequest request = new IndexRequest( | ||
| "index", // <1> | ||
| "type", // <2> | ||
| "id"); // <3> |
tlrx
left a comment
There was a problem hiding this comment.
LGTM, thanks for doing this documentation effort
This commit restructures the existing high level client docs, adapts the existing delete method docs and adds docs for the index method.
* master: (52 commits) Include shared/attributes.asciidoc from docs master Fixed page breaks for ICU Collation Keyword Fields Remove QueryParseContext (elastic#25486) [Test] Use a common testing class for all XContent filtering tests (elastic#25491) Tests fix - Significant terms/text aggs (elastic#25499) [DOCS] add docs for REST high level client index method (elastic#25501) Tests: Add Debian 9 (Stretch) to the packaging tests test: Run flush before upgrade and refresh after upgrade. Fix third party audit for repository-hdfs [TEST] Expect nodes getting disconnected quickly testPrimaryFailureIncreasesTerm should use assertBusy to wait for yellow Cleanup network / transport related settings (elastic#25489) Fix repository-hdfs plugin packaging test Remove allocation id from replica replication response (elastic#25488) Adjust BWC version on bad allocation request test Upgrading HDFS Repository Plugin to use HDFS 2.8.1 Client (elastic#25497) Adjust status on bad allocation explain requests Preliminary support for ARM Add doc note regarding explicit publish host Fix typo in name of test ...
This commit restructures the existing high level client docs, adapts the existing delete method docs and adds docs for the index method.