Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include withJson docs only in correct versions #217

Merged
merged 1 commit into from
Mar 28, 2022
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
4 changes: 4 additions & 0 deletions docs/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
include::{asciidoc-dir}/../../shared/versions/stack/{source_branch}.asciidoc[]
include::{asciidoc-dir}/../../shared/attributes.asciidoc[]

include::_releases.asciidoc[]

:java-client: Java API Client
:doc-tests: {docdir}/../java-client/src/test/java/co/elastic/clients/documentation

Expand All @@ -25,7 +27,9 @@ include::installation.asciidoc[]
include::connecting.asciidoc[]
include::migrate.asciidoc[]
include::api-conventions.asciidoc[]
ifdef::is_main_branch,v8_1_1_released,v7_17_2_released[]
include::loading-json.asciidoc[]
endif::is_main_branch,v8_1_1_released,v7_17_2_released[]
include::javadoc-and-source.asciidoc[]

include::{elasticsearch-root}/docs/java-rest/low-level/index.asciidoc[]
8 changes: 8 additions & 0 deletions docs/loading-json.asciidoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
[[loading-json]]
== Creating API objects from JSON data

ifeval::["{minor-version}" == "7.17"]
NOTE: This feature was added in version 7.17.2
endif::[]

ifeval::["{minor-version}" == "8.1"]
NOTE: This feature was added in version 8.1.1
endif::[]

A common workflow during application development with Elasticsearch is to use the Kibana Developer Console to interactively prepare and test queries, aggregations, index mappings and other complex API calls. This results in working JSON snippets that you may want to use in your application.

As translating these JSON snippets to Java code can be time-consuming and error-prone, most of the data classes in the {java-client} can be loaded from JSON text: object builders have `withJson()` methods that populate the builder from raw JSON. This also allows you to combine dynamically loaded JSON with programmatic construction of objects.
Expand Down