Skip to content

Commit 1a0e147

Browse files
committed
Migrate documentation site to Antora.
Closes #2685
1 parent a82952b commit 1a0e147

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+386
-265
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ target
2626
/zap.env
2727
/localdocker.env
2828
.localdocker-env
29+
30+
build/
31+
node_modules
32+
node
33+
package.json
34+
package-lock.json

README.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ If you want to raise an issue, please follow the recommendations below:
137137

138138
* Before you log a bug, please search the
139139
https://github.com/spring-projects/spring-data-elasticsearch/issues[issue tracker] to see if someone has already reported the problem.
140-
* If the issue doesnt already exist, https://github.com/spring-projects/spring-data-elasticsearch/issues/new[create a new issue].
140+
* If the issue doesn't already exist, https://github.com/spring-projects/spring-data-elasticsearch/issues/new[create a new issue].
141141
* Please provide as much information as possible with the issue report, we like to know the version of Spring Data Elasticsearch that you are using and JVM version.
142142
* If you need to paste code, or include a stack trace use Markdown +++```+++ escapes before and after your text.
143143
* If possible try to create a test-case or project that replicates the issue.
@@ -168,10 +168,10 @@ Building the documentation builds also the project without running tests.
168168

169169
[source,bash]
170170
----
171-
$ ./mvnw clean install -Pdistribute
171+
$ ./mvnw clean install -Pantora
172172
----
173173

174-
The generated documentation is available from `target/site/reference/html/index.html`.
174+
The generated documentation is available from `target/antora/site/index.html`.
175175

176176
== Examples
177177

pom.xml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,10 +409,6 @@
409409
<groupId>org.apache.maven.plugins</groupId>
410410
<artifactId>maven-assembly-plugin</artifactId>
411411
</plugin>
412-
<plugin>
413-
<groupId>org.asciidoctor</groupId>
414-
<artifactId>asciidoctor-maven-plugin</artifactId>
415-
</plugin>
416412
</plugins>
417413
</build>
418414

@@ -463,6 +459,30 @@
463459
</plugins>
464460
</build>
465461
</profile>
462+
463+
<profile>
464+
<id>antora-process-resources</id>
465+
<build>
466+
<resources>
467+
<resource>
468+
<directory>src/main/antora/resources/antora-resources</directory>
469+
<filtering>true</filtering>
470+
</resource>
471+
</resources>
472+
</build>
473+
</profile>
474+
475+
<profile>
476+
<id>antora</id>
477+
<build>
478+
<plugins>
479+
<plugin>
480+
<groupId>io.spring.maven.antora</groupId>
481+
<artifactId>antora-maven-plugin</artifactId>
482+
</plugin>
483+
</plugins>
484+
</build>
485+
</profile>
466486
</profiles>
467487

468488
<repositories>

src/main/antora/antora-playbook.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# PACKAGES antora@3.2.0-alpha.2 @antora/atlas-extension:1.0.0-alpha.1 @antora/collector-extension@1.0.0-alpha.3 @springio/antora-extensions@1.1.0-alpha.2 @asciidoctor/tabs@1.0.0-alpha.12 @opendevise/antora-release-line-extension@1.0.0-alpha.2
2+
#
3+
# The purpose of this Antora playbook is to build the docs in the current branch.
4+
antora:
5+
extensions:
6+
- '@antora/collector-extension'
7+
- require: '@springio/antora-extensions/root-component-extension'
8+
root_component_name: 'data-elasticsearch'
9+
site:
10+
title: Spring Data Elasticsearch
11+
url: https://docs.spring.io/spring-data-elasticsearch/reference/
12+
content:
13+
sources:
14+
- url: ./../../..
15+
branches: HEAD
16+
start_path: src/main/antora
17+
worktrees: true
18+
- url: https://github.com/spring-projects/spring-data-commons
19+
# Refname matching:
20+
# https://docs.antora.org/antora/latest/playbook/content-refname-matching/
21+
branches: [ main, 3.2.x ]
22+
start_path: src/main/antora
23+
asciidoc:
24+
attributes:
25+
page-pagination: ''
26+
hide-uri-scheme: '@'
27+
tabs-sync-option: '@'
28+
chomp: 'all'
29+
extensions:
30+
- '@asciidoctor/tabs'
31+
- '@springio/asciidoctor-extensions'
32+
sourcemap: true
33+
urls:
34+
latest_version_segment: ''
35+
runtime:
36+
log:
37+
failure_level: warn
38+
format: pretty
39+
ui:
40+
bundle:
41+
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.3.5/ui-bundle.zip
42+
snapshot: true

src/main/antora/antora.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: data-elasticsearch
2+
version: true
3+
title: Spring Data Elasticsearch
4+
nav:
5+
- modules/ROOT/nav.adoc
6+
ext:
7+
collector:
8+
- run:
9+
command: ./mvnw validate process-resources -am -Pantora-process-resources
10+
local: true
11+
scan:
12+
dir: target/classes/

src/main/antora/modules/ROOT/nav.adoc

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
* xref:index.adoc[Overview]
2+
** xref:commons/upgrade.adoc[]
3+
** xref:migration-guides.adoc[]
4+
*** xref:migration-guides/migration-guide-3.2-4.0.adoc[]
5+
*** xref:migration-guides/migration-guide-4.0-4.1.adoc[]
6+
*** xref:migration-guides/migration-guide-4.1-4.2.adoc[]
7+
*** xref:migration-guides/migration-guide-4.2-4.3.adoc[]
8+
*** xref:migration-guides/migration-guide-4.3-4.4.adoc[]
9+
*** xref:migration-guides/migration-guide-4.4-5.0.adoc[]
10+
*** xref:migration-guides/migration-guide-5.0-5.1.adoc[]
11+
*** xref:migration-guides/migration-guide-5.1-5.2.adoc[]
12+
13+
14+
* xref:elasticsearch.adoc[]
15+
** xref:elasticsearch/clients.adoc[]
16+
** xref:elasticsearch/object-mapping.adoc[]
17+
** xref:elasticsearch/template.adoc[]
18+
** xref:elasticsearch/reactive-template.adoc[]
19+
** xref:elasticsearch/entity-callbacks.adoc[]
20+
** xref:elasticsearch/auditing.adoc[]
21+
** xref:elasticsearch/join-types.adoc[]
22+
** xref:elasticsearch/routing.adoc[]
23+
** xref:elasticsearch/misc.adoc[]
24+
** xref:elasticsearch/scripted-and-runtime-fields.adoc[]
25+
26+
* xref:repositories.adoc[]
27+
** xref:repositories/core-concepts.adoc[]
28+
** xref:repositories/definition.adoc[]
29+
** xref:elasticsearch/repositories/elasticsearch-repositories.adoc[]
30+
** xref:elasticsearch/repositories/reactive-elasticsearch-repositories.adoc[]
31+
** xref:repositories/create-instances.adoc[]
32+
** xref:repositories/query-methods-details.adoc[]
33+
** xref:elasticsearch/repositories/elasticsearch-repository-queries.adoc[]
34+
** xref:repositories/projections.adoc[]
35+
** xref:repositories/custom-implementations.adoc[]
36+
** xref:repositories/core-domain-events.adoc[]
37+
** xref:repositories/null-handling.adoc[]
38+
** xref:elasticsearch/repositories/cdi-integration.adoc[]
39+
** xref:repositories/query-keywords-reference.adoc[]
40+
** xref:repositories/query-return-types-reference.adoc[]
41+
42+
* https://github.com/spring-projects/spring-data-commons/wiki[Wiki]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include::{commons}@data-commons::page$upgrade.adoc[]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[[elasticsearch.core]]
2+
= Elasticsearch Support
3+
:page-section-summary-toc: 1
4+
5+
Spring Data support for Elasticsearch contains a wide range of features:
6+
7+
* Spring configuration support for various xref:elasticsearch/clients.adoc[Elasticsearch clients].
8+
* The xref:elasticsearch/template.adoc[`ElasticsearchTemplate` and `ReactiveElasticsearchTemplate`] helper classes that provide object mapping between ES index operations and POJOs.
9+
* xref:elasticsearch/template.adoc#exception-translation[Exception translation] into Spring's portable {springDocsUrl}data-access.html#dao-exceptions[Data Access Exception Hierarchy].
10+
* Feature rich xref:elasticsearch/object-mapping.adoc[object mapping] integrated with _Spring's_ {springDocsUrl}core.html#core-convert[Conversion Service].
11+
* xref:elasticsearch/object-mapping.adoc#elasticsearch.mapping.meta-model.annotations[Annotation-based mapping] metadata that is extensible to support other metadata formats.
12+
* Java-based xref:elasticsearch/template.adoc#cassandra.template.query[query, criteria, and update DSLs].
13+
* Automatic implementation of xref:repositories.adoc[imperative and reactive `Repository` interfaces] including support for xref:repositories/custom-implementations.adoc[custom query methods].
14+
15+
For most data-oriented tasks, you can use the `[Reactive]ElasticsearchTemplate` or the `Repository` support, both of which use the rich object-mapping functionality.
16+
Spring Data Elasticsearch uses consistent naming conventions on objects in various APIs to those found in the DataStax Java Driver so that they are familiar and so that you can map your existing knowledge onto the Spring APIs.

src/main/asciidoc/reference/elasticsearch-auditing.adoc renamed to src/main/antora/modules/ROOT/pages/elasticsearch/auditing.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[[elasticsearch.auditing]]
2-
== Elasticsearch Auditing
2+
= Elasticsearch Auditing
33

44
[[elasticsearch.auditing.preparing]]
5-
=== Preparing entities
5+
== Preparing entities
66

77
In order for the auditing code to be able to decide whether an entity instance is new, the entity must implement the `Persistable<ID>` interface which is defined as follows:
88

@@ -56,7 +56,7 @@ public class Person implements Persistable<Long> {
5656
<.> an object is new if it either has no `id` or none of fields containing creation attributes are set.
5757

5858
[[elasticsearch.auditing.activating]]
59-
=== Activating auditing
59+
== Activating auditing
6060

6161
After the entities have been set up and providing the `AuditorAware` - or `ReactiveAuditorAware` - the Auditing must be activated by setting the `@EnableElasticsearchAuditing` on a configuration class:
6262

src/main/asciidoc/reference/elasticsearch-clients.adoc renamed to src/main/antora/modules/ROOT/pages/elasticsearch/clients.adoc

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33

44
This chapter illustrates configuration and usage of supported Elasticsearch client implementations.
55

6-
Spring Data Elasticsearch operates upon an Elasticsearch client (provided by Elasticsearch client libraries) that is
7-
connected to a single Elasticsearch node or a cluster.
8-
Although the Elasticsearch Client can be used directly to work with the cluster, applications using Spring Data
9-
Elasticsearch normally use the higher level abstractions of <<elasticsearch.operations>> and <<elasticsearch.repositories>>.
6+
Spring Data Elasticsearch operates upon an Elasticsearch client (provided by Elasticsearch client libraries) that is connected to a single Elasticsearch node or a cluster.
7+
Although the Elasticsearch Client can be used directly to work with the cluster, applications using Spring Data Elasticsearch normally use the higher level abstractions of xref:elasticsearch/template.adoc[Elasticsearch Operations] and xref:elasticsearch/repositories/elasticsearch-repositories.adoc[Elasticsearch Repositories].
108

119
[[elasticsearch.clients.restclient]]
1210
== Imperative Rest Client
@@ -23,13 +21,14 @@ public class MyClientConfig extends ElasticsearchConfiguration {
2321
2422
@Override
2523
public ClientConfiguration clientConfiguration() {
26-
return ClientConfiguration.builder() <.>
27-
.connectedTo("localhost:9200")
24+
return ClientConfiguration.builder() <.>
25+
.connectedTo("localhost:9200")
2826
.build();
2927
}
3028
}
3129
----
32-
<.> for a detailed description of the builder methods see <<elasticsearch.clients.configuration>>
30+
31+
<.> for a detailed description of the builder methods see xref:elasticsearch/clients.adoc#elasticsearch.clients.configuration[Client Configuration]
3332
====
3433

3534
The `ElasticsearchConfiguration` class allows further configuration by overriding for example the `jsonpMapper()` or `transportOptions()` methods.
@@ -43,14 +42,14 @@ The following beans can then be injected in other Spring components:
4342
import org.springframework.beans.factory.annotation.Autowired;@Autowired
4443
ElasticsearchOperations operations; <.>
4544
46-
@Autowired
45+
@Autowired
4746
ElasticsearchClient elasticsearchClient; <.>
4847
4948
@Autowired
5049
RestClient restClient; <.>
5150
5251
@Autowired
53-
JsonpMapper jsonpMapper; <.>
52+
JsonpMapper jsonpMapper; <.>
5453
----
5554
5655
<.> an implementation of `ElasticsearchOperations`
@@ -78,12 +77,13 @@ public class MyClientConfig extends ReactiveElasticsearchConfiguration {
7877
@Override
7978
public ClientConfiguration clientConfiguration() {
8079
return ClientConfiguration.builder() <.>
81-
.connectedTo("localhost:9200")
80+
.connectedTo("localhost:9200")
8281
.build();
8382
}
8483
}
8584
----
86-
<.> for a detailed description of the builder methods see <<elasticsearch.clients.configuration>>
85+
86+
<.> for a detailed description of the builder methods see xref:elasticsearch/clients.adoc#elasticsearch.clients.configuration[Client Configuration]
8787
====
8888

8989
The `ReactiveElasticsearchConfiguration` class allows further configuration by overriding for example the `jsonpMapper()` or `transportOptions()` methods.
@@ -96,14 +96,14 @@ The following beans can then be injected in other Spring components:
9696
@Autowired
9797
ReactiveElasticsearchOperations operations; <.>
9898
99-
@Autowired
99+
@Autowired
100100
ReactiveElasticsearchClient elasticsearchClient; <.>
101101
102102
@Autowired
103103
RestClient restClient; <.>
104104
105105
@Autowired
106-
JsonpMapper jsonpMapper; <.>
106+
JsonpMapper jsonpMapper; <.>
107107
----
108108
109109
the following can be injected:
@@ -161,16 +161,15 @@ ClientConfiguration clientConfiguration = ClientConfiguration.builder()
161161
162162
<.> Define default headers, if they need to be customized
163163
<.> Use the builder to provide cluster addresses, set default `HttpHeaders` or enable SSL.
164-
<.> Optionally enable SSL. There exist overloads of this function that can take a `SSLContext` or as an alternative the fingerprint of the certificate as it is output by Elasticsearch 8 on startup.
164+
<.> Optionally enable SSL.There exist overloads of this function that can take a `SSLContext` or as an alternative the fingerprint of the certificate as it is output by Elasticsearch 8 on startup.
165165
<.> Optionally set a proxy.
166166
<.> Optionally set a path prefix, mostly used when different clusters a behind some reverse proxy.
167167
<.> Set the connection timeout.
168168
<.> Set the socket timeout.
169169
<.> Optionally set headers.
170170
<.> Add basic authentication.
171171
<.> A `Supplier<HttpHeaders>` function can be specified which is called every time before a request is sent to Elasticsearch - here, as an example, the current time is written in a header.
172-
<.> a function to configure the created client (see <<elasticsearch.clients.configuration.callbacks>>), can be added
173-
multiple times.
172+
<.> a function to configure the created client (see xref:elasticsearch/clients.adoc#elasticsearch.clients.configuration.callbacks[Client configuration callbacks]), can be added multiple times.
174173
====
175174

176175
IMPORTANT: Adding a Header supplier as shown in above example allows to inject headers that may change over the time, like authentication JWT tokens.
@@ -179,8 +178,8 @@ If this is used in the reactive setup, the supplier function *must not* block!
179178
[[elasticsearch.clients.configuration.callbacks]]
180179
=== Client configuration callbacks
181180

182-
The `ClientConfiguration` class offers the most common parameters to configure the client. In the case this is not
183-
enough, the user can add callback functions by using the `withClientConfigurer(ClientConfigurationCallback<?>)` method.
181+
The `ClientConfiguration` class offers the most common parameters to configure the client.
182+
In the case this is not enough, the user can add callback functions by using the `withClientConfigurer(ClientConfigurationCallback<?>)` method.
184183

185184
The following callbacks are provided:
186185

@@ -222,9 +221,8 @@ ClientConfiguration.builder()
222221
[[elasticsearch.clients.logging]]
223222
== Client Logging
224223

225-
To see what is actually sent to and received from the server `Request` / `Response` logging on the transport level
226-
needs to be turned on as outlined in the snippet below. This can be enabled in the Elasticsearch client by setting
227-
the level of the `tracer` package to "trace" (see
224+
To see what is actually sent to and received from the server `Request` / `Response` logging on the transport level needs to be turned on as outlined in the snippet below.
225+
This can be enabled in the Elasticsearch client by setting the level of the `tracer` package to "trace" (see
228226
https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-low-usage-logging.html)
229227

230228
.Enable transport layer logging

src/main/asciidoc/reference/elasticsearch-new.adoc renamed to src/main/antora/modules/ROOT/pages/elasticsearch/elasticsearch-new.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
* Upgrade to Elasticsearch 7.6.2.
6767
* Deprecation of `TransportClient` usage.
6868
* Implements most of the mapping-types available for the index mappings.
69-
* Removal of the Jackson `ObjectMapper`, now using the <<elasticsearch.mapping.meta-model,MappingElasticsearchConverter>>
69+
* Removal of the Jackson `ObjectMapper`, now using the xref:elasticsearch/object-mapping.adoc#elasticsearch.mapping.meta-model[MappingElasticsearchConverter]
7070
* Cleanup of the API in the `*Operations` interfaces, grouping and renaming methods so that they match the Elasticsearch API, deprecating the old methods, aligning with other Spring Data modules.
7171
* Introduction of `SearchHit<T>` class to represent a found document together with the relevant result metadata for this document (i.e. _sortValues_).
7272
* Introduction of the `SearchHits<T>` class to represent a whole search result together with the metadata for the complete search result (i.e. _max_score_).
@@ -80,7 +80,7 @@
8080

8181
* Secured Elasticsearch cluster support with Basic Authentication and SSL transport.
8282
* Upgrade to Elasticsearch 6.8.1.
83-
* Reactive programming support with <<elasticsearch.reactive.operations>> and <<elasticsearch.reactive.repositories>>.
84-
* Introduction of the <<elasticsearch.mapping.meta-model,ElasticsearchEntityMapper>> as an alternative to the Jackson `ObjectMapper`.
83+
* Reactive programming support with xref:elasticsearch/repositories/reactive-elasticsearch-repositories.adoc[Reactive Elasticsearch Repositories] and xref:.
84+
* Introduction of the xref:elasticsearch/object-mapping.adoc#elasticsearch.mapping.meta-model[ElasticsearchEntityMapper] as an alternative to the Jackson `ObjectMapper`.
8585
* Field name customization in `@Field`.
8686
* Support for Delete by Query.

src/main/asciidoc/reference/elasticsearch-entity-callbacks.adoc renamed to src/main/antora/modules/ROOT/pages/elasticsearch/entity-callbacks.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
include::{commons}@data-commons::page$entity-callbacks.adoc[]
2+
13
[[elasticsearch.entity-callbacks]]
2-
= Elasticsearch EntityCallbacks
4+
== Store specific EntityCallbacks
35

46
Spring Data Elasticsearch uses the `EntityCallback` API internally for its auditing support and reacts on the following callbacks:
57

src/main/asciidoc/reference/elasticsearch-join-types.adoc renamed to src/main/antora/modules/ROOT/pages/elasticsearch/join-types.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public class Statement {
112112
}
113113
}
114114
----
115-
<.> for routing related info see <<elasticsearch.routing>>
115+
<.> for routing related info see xref:elasticsearch/routing.adoc[Routing values]
116116
<.> a question can have answers and comments
117117
<.> an answer can have votes
118118
<.> the `JoinField` property is used to combine the name (_question_, _answer_, _comment_ or _vote_) of the relation with the parent id.
@@ -208,13 +208,13 @@ void init() {
208208
<2> the first answer to the question
209209
<3> the second answer
210210
<4> a comment to the question
211-
<5> a vote for the first answer, this needs to have the routing set to the weather document, see <<elasticsearch.routing>>.
211+
<5> a vote for the first answer, this needs to have the routing set to the weather document, see xref:elasticsearch/routing.adoc[Routing values].
212212
====
213213

214214
[[elasticsearch.jointype.retrieving]]
215215
== Retrieving data
216216

217-
Currently native queries must be used to query the data, so there is no support from standard repository methods. <<repositories.custom-implementations>> can be used instead.
217+
Currently native queries must be used to query the data, so there is no support from standard repository methods. xref:repositories/custom-implementations.adoc[] can be used instead.
218218

219219
The following code shows as an example how to retrieve all entries that have a _vote_ (which must be _answers_, because only answers can have a vote) using an `ElasticsearchOperations` instance:
220220

0 commit comments

Comments
 (0)