Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,10 @@
import java.io.IOException;

/**
* This class is used to generate the Java Main API documentation.
* You need to wrap your code between two tags like:
* // tag::example[]
* // end::example[]
*
* Where example is your tag name.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need these comments any more. They were useful when I first built the extraction tool for education but I think something like what I have now is shorter and easier to read. Ideas? Suggestions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

*
* Then in the documentation, you can extract what is between tag and end tags with
* ["source","java",subs="attributes,callouts,macros"]
* --------------------------------------------------
* include-tagged::{doc-tests}/MainDocumentationIT.java[example]
* --------------------------------------------------
* Documentation for miscellaneous APIs in the high level java client.
* Code wrapped in {@code tag} and {@code end} tags is included in the docs.
*/
public class MainDocumentationIT extends ESRestHighLevelClientTestCase {
public class MiscellaneousDocumentationIT extends ESRestHighLevelClientTestCase {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed this because I'd like to stick the other miscellaneous methods into this test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++


public void testMain() throws IOException {
RestHighLevelClient client = highLevelClient();
Expand All @@ -67,6 +57,14 @@ public void testMain() throws IOException {
}
}

public void testPing() throws IOException {
RestHighLevelClient client = highLevelClient();
//tag::ping-execute
boolean response = client.ping();
//end::ping-execute
assertTrue(response);
}

public void testInitializationFromClientBuilder() throws IOException {
//tag::rest-high-level-client-init
RestHighLevelClient client = new RestHighLevelClient(
Expand Down
4 changes: 2 additions & 2 deletions docs/java-rest/high-level/getting-started.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ to be built as follows:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/MainDocumentationIT.java[rest-high-level-client-init]
include-tagged::{doc-tests}/MiscellaneousDocumentationIT.java[rest-high-level-client-init]
--------------------------------------------------

The high-level client will internally create the low-level client used to
Expand All @@ -139,7 +139,7 @@ method, which will close the internal `RestClient` instance.

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/MainDocumentationIT.java[rest-high-level-client-close]
include-tagged::{doc-tests}/MiscellaneousDocumentationIT.java[rest-high-level-client-close]
--------------------------------------------------

In the rest of this documentation about the Java High Level Client, the `RestHighLevelClient` instance
Expand Down
6 changes: 2 additions & 4 deletions docs/java-rest/high-level/migration.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ argument:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/MainDocumentationIT.java[rest-high-level-client-init]
include-tagged::{doc-tests}/MiscellaneousDocumentationIT.java[rest-high-level-client-init]
--------------------------------------------------

NOTE: The `RestClient` uses Elasticsearch's HTTP service which is
Expand All @@ -91,7 +91,7 @@ must be replaced with:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/MainDocumentationIT.java[rest-high-level-client-close]
include-tagged::{doc-tests}/MiscellaneousDocumentationIT.java[rest-high-level-client-close]
--------------------------------------------------

=== Changing the application's code
Expand Down Expand Up @@ -351,5 +351,3 @@ body, but any other JSON parser could have been use instead.

We love to hear from you! Please give us your feedback about your migration
experience and how to improve the Java High Level Rest Client on https://discuss.elastic.co/[our forum].


4 changes: 2 additions & 2 deletions docs/java-rest/high-level/miscellaneous/main.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Cluster information can be retrieved using the `info()` method:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/MainDocumentationIT.java[main-execute]
include-tagged::{doc-tests}/MiscellaneousDocumentationIT.java[main-execute]
--------------------------------------------------

[[java-rest-high-main-response]]
Expand All @@ -18,7 +18,7 @@ The returned `MainResponse` provides various kinds of information about the clus

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/MainDocumentationIT.java[main-response]
include-tagged::{doc-tests}/MiscellaneousDocumentationIT.java[main-response]
--------------------------------------------------
<1> Retrieve the name of the cluster as a `ClusterName`
<2> Retrieve the unique identifier of the cluster
Expand Down
13 changes: 13 additions & 0 deletions docs/java-rest/high-level/miscellaneous/ping.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[[java-rest-high-ping]]
=== Ping API

[[java-rest-high-ping-request]]
==== Execution

The `ping()` method checks if the cluster is up and available to
process requests and returns a boolean:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/MiscellaneousDocumentationIT.java[ping-execute]
--------------------------------------------------
2 changes: 2 additions & 0 deletions docs/java-rest/high-level/supported-apis.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ include::search/scroll.asciidoc[]
The Java High Level REST Client supports the following Miscellaneous APIs:

* <<java-rest-high-main>>
* <<java-rest-high-ping>>

include::miscellaneous/main.asciidoc[]
include::miscellaneous/ping.asciidoc[]

== Indices APIs

Expand Down