Skip to content

Commit cb750e0

Browse files
committed
DATAES-844 - Improve TOC formatting for migration guides.
1 parent 0f84158 commit cb750e0

File tree

5 files changed

+38
-29
lines changed

5 files changed

+38
-29
lines changed

src/main/asciidoc/index.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@ include::{spring-data-commons-docs}/repository-namespace-reference.adoc[]
4444
include::{spring-data-commons-docs}/repository-populator-namespace-reference.adoc[]
4545
include::{spring-data-commons-docs}/repository-query-keywords-reference.adoc[]
4646
include::{spring-data-commons-docs}/repository-query-return-types-reference.adoc[]
47+
include::reference/migration-guides.adoc[]
4748
:leveloffset: -1

src/main/asciidoc/preface.adoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ The Spring Data Elasticsearch project applies core Spring concepts to the develo
99
You will notice similarities to the Spring data solr and mongodb support in the Spring Framework.
1010

1111
include::reference/elasticsearch-new.adoc[leveloffset=+1]
12-
include::reference/elasticsearch-migration-guide-3.2-4.0.adoc[leveloffset=+1]
13-
include::reference/elasticsearch-migration-guide-4.0-4.1.adoc[leveloffset=+1]
1412

1513
[[preface.metadata]]
1614
== Project Metadata
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
[[elasticsearch-migration-guide-3.2-4.0]]
2-
== Upgrading from 3.2.x to 4.0.x
2+
= Upgrading from 3.2.x to 4.0.x
33

44
This section describes breaking changes from version 3.2.x to 4.0.x and how removed features can be replaced by new introduced features.
55

6-
7-
=== Removal of the used Jackson Mapper.
6+
[[elasticsearch-migration-guide-3.2-4.0.jackson-removal]]
7+
== Removal of the used Jackson Mapper
88

99
One of the changes in version 4.0.x is that Spring Data Elasticsearch does not use the Jackson Mapper anymore to map an entity to the JSON representation needed for Elasticsearch (see <<elasticsearch.mapping>>). In version 3.2.x the Jackson Mapper was the default that was used. It was possible to switch to the meta-model based converter (named `ElasticsearchEntityMapper`) by explicitly configuring it (<<elasticsearch.mapping.meta-model>>).
1010

1111
In version 4.0.x the meta-model based converter is the only one that is available and does not need to be configured explicitly. If you had a custom configuration to enable the meta-model converter by providing a bean like this:
1212

13-
[code,java]
13+
[source,java]
1414
----
1515
@Bean
1616
@Override
17-
public EntityMapper entityMapper() {
17+
public EntityMapper entityMapper() {
1818
1919
ElasticsearchEntityMapper entityMapper = new ElasticsearchEntityMapper(
20-
elasticsearchMappingContext(), new DefaultConversionService()
20+
elasticsearchMappingContext(), new DefaultConversionService()
2121
);
22-
entityMapper.setConversions(elasticsearchCustomConversions());
22+
entityMapper.setConversions(elasticsearchCustomConversions());
2323
2424
return entityMapper;
2525
}
@@ -30,15 +30,15 @@ You now have to remove this bean, the `ElasticsearchEntityMapper` interface has
3030
.Entity configuration
3131
Some users had custom Jackson annotations on the entity class, for example in order to define a custom name for the mapped document in Elasticsearch or to configure date conversions. These are not taken into account anymore. The needed functionality is now provided with Spring Data Elasticsearch's `@Field` annotation. Please see <<elasticsearch.mapping.meta-model.annotations>> for detailed information.
3232

33-
34-
=== Removal of implicit index name from query objects
33+
[[elasticsearch-migration-guide-3.2-4.0.implicit-index-name]]
34+
== Removal of implicit index name from query objects
3535

3636
In 3.2.x the different query classes like `IndexQuery` or `SearchQuery` had properties that were taking the index name or index names that they were operating upon. If these were not set, the passed in entity was inspected to retrieve the index name that was set in the `@Document` annotation. +
3737
In 4.0.x the index name(s) must now be provided in an additional parameter of type `IndexCoordinates`. By separating this, it now is possible to use one query object against different indices.
3838

3939
So for example the following code:
4040

41-
[code,java]
41+
[source,java]
4242
----
4343
IndexQuery indexQuery = new IndexQueryBuilder()
4444
.withId(person.getId().toString())
@@ -50,22 +50,22 @@ String documentId = elasticsearchOperations.index(indexQuery);
5050

5151
must be changed to:
5252

53-
[code,java]
53+
[source,java]
5454
----
5555
IndexCoordinates indexCoordinates = elasticsearchOperations.getIndexCoordinatesFor(person.getClass());
5656
5757
IndexQuery indexQuery = new IndexQueryBuilder()
5858
.withId(person.getId().toString())
5959
.withObject(person)
6060
.build();
61-
61+
6262
String documentId = elasticsearchOperations.index(indexQuery, indexCoordinates);
6363
----
6464

6565
To make it easier to work with entities and use the index name that is contained in the entitie's `@Document` annotation, new methods have been added like `DocumentOperations.save(T entity)`;
6666

67-
68-
=== The new Operations interfaces
67+
[[elasticsearch-migration-guide-3.2-4.0.new-operations]]
68+
== The new Operations interfaces
6969

7070
In version 3.2 there was the `ElasticsearchOperations` interface that defined all the methods for the `ElasticsearchTemplate` class. In version 4 the functions have been split into different interfaces, aligning these interfaces with the Elasticsearch API:
7171

@@ -77,10 +77,10 @@ In version 3.2 there was the `ElasticsearchOperations` interface that defined al
7777

7878
NOTE: All the functions from the `ElasticsearchOperations` interface in version 3.2 that are now moved to the `IndexOperations` interface are still available, they are marked as deprecated and have default implementations that delegate to the new implementation:
7979

80-
[code,java]
80+
[source,java]
8181
----
8282
/**
83-
* Create an index for given indexName .
83+
* Create an index for given indexName.
8484
*
8585
* @param indexName the name of the index
8686
* @return {@literal true} if the index was created
@@ -92,17 +92,17 @@ default boolean createIndex(String indexName) {
9292
}
9393
----
9494

95+
[[elasticsearch-migration-guide-3.2-4.0.deprecations]]
96+
== Deprecations
9597

96-
=== Deprecations
97-
98-
==== Methods and classes
98+
=== Methods and classes
9999

100100
Many functions and classes have been deprecated. These functions still work, but the Javadocs show with what they should be replaced.
101101

102102
.Example from ElasticsearchOperations
103-
[code,java]
103+
[source,java]
104104
----
105-
/**
105+
/*
106106
* Retrieves an object from an index.
107107
*
108108
* @param query the query defining the id of the object to get
@@ -113,15 +113,16 @@ Many functions and classes have been deprecated. These functions still work, but
113113
@Deprecated
114114
@Nullable
115115
<T> T queryForObject(GetQuery query, Class<T> clazz);
116-
----
116+
----
117117

118-
==== Elasticsearch deprecations
118+
=== Elasticsearch deprecations
119119

120120
Since version 7 the Elasticsearch `TransportClient` is deprecated, it will be removed with Elasticsearch version 8. Spring Data Elasticsearch deprecates the `ElasticsearchTemplate` class which uses the `TransportClient` in version 4.0.
121121

122122
Mapping types were removed from Elasticsearch 7, they still exist as deprecated values in the Spring Data `@Document` annotation and the `IndexCoordinates` class but they are not used anymore internally.
123123

124-
=== Removals
124+
[[elasticsearch-migration-guide-3.2-4.0.removal]]
125+
== Removals
125126

126127
* As already described, the `ElasticsearchEntityMapper` interface has been removed.
127128

@@ -130,4 +131,3 @@ Mapping types were removed from Elasticsearch 7, they still exist as deprecated
130131
* The method `org.springframework.data.elasticsearch.core.ElasticsearchOperations.query(SearchQuery query, ResultsExtractor<T> resultsExtractor);` and the `org.springframework.data.elasticsearch.core.ResultsExtractor` interface have been removed. These could be used to parse the result from Elasticsearch for cases in which the response mapping done with the Jackson based mapper was not enough. Since version 4.0, there are the new <<elasticsearch.operations.searchresulttypes>> to return the information from an Elasticsearch response, so there is no need to expose this low level functionality.
131132

132133
* The low level methods `startScroll`, `continueScroll` and `clearScroll` have been removed from the `ElasticsearchOperations` interface. For low level scroll API access, there now are `searchScrollStart`, `searchScrollContinue` and `searchScrollClear` methods on the `ElasticsearchRestTemplate` class.
133-
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
[[elasticsearch-migration-guide-4.0-4.1]]
2-
== Upgrading from 4.0.x to 4.1.x
2+
= Upgrading from 4.0.x to 4.1.x
33

44
This section describes breaking changes from version 4.0.x to 4.1.x and how removed features can be replaced by new introduced features.
55

6-
=== Removals
6+
[[elasticsearch-migration-guide-4.0-4.1.removal]]
7+
== Removals
78

89
The _type mappings_ parameters of the `@Document` annotation and the `IndexCoordinates` object were removed. They had been deprecated in Spring Data Elasticsearch 4.0 and their values weren't used anymore.
910

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[[elasticsearch.migration]]
2+
= Appendix E: Migration Guides
3+
4+
// line breaks required otherwise the TOC breaks due to joining of first/last lines.
5+
:leveloffset: +1
6+
include::elasticsearch-migration-guide-3.2-4.0.adoc[]
7+
8+
include::elasticsearch-migration-guide-4.0-4.1.adoc[]
9+
:leveloffset: -1

0 commit comments

Comments
 (0)