Skip to content

Commit 1668afd

Browse files
committed
documentation modification
1 parent 84072c9 commit 1668afd

File tree

8 files changed

+24
-10
lines changed

8 files changed

+24
-10
lines changed

src/main/antora/modules/ROOT/pages/migration-guides/migration-guide-5.3-5.4.adoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ This section describes breaking changes from version 5.3.x to 5.4.x and how remo
66
[[elasticsearch-migration-guide-5.3-5.4.breaking-changes]]
77
== Breaking Changes
88

9+
[[elasticsearch-migration-guide-5.3-5.4.breaking-changes.knn-search]]
10+
=== knn search
11+
The `withKnnQuery` method in `NativeQueryBuilder` has been replaced with `withKnnSearches` to build a `NativeQuery` with knn search.
12+
13+
`KnnQuery` and `KnnSearch` are two different classes in elasticsearch java client and are used for different queries, with different parameters supported:
14+
15+
- `KnnSearch`: is https://www.elastic.co/guide/en/elasticsearch/reference/8.13/search-search.html#search-api-knn[the top level `knn` query] in the elasticsearch request;
16+
- `KnnQuery`: is https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-knn-query.html[the `knn` query inside `query` clause];
17+
18+
If `KnnQuery` is still preferable, please be sure to construct it inside `query` clause manually, by means of `withQuery(co.elastic.clients.elasticsearch._types.query_dsl.Query query)` clause in `NativeQueryBuilder`.
19+
920
[[elasticsearch-migration-guide-5.3-5.4.deprecations]]
1021
== Deprecations
1122

src/main/java/org/springframework/data/elasticsearch/annotations/Field.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,21 +199,21 @@
199199
/**
200200
* to be used in combination with {@link FieldType#Dense_Vector}
201201
*
202-
* @since 5.3.1
202+
* @since 5.4
203203
*/
204204
String elementType() default FieldElementType.DEFAULT;
205205

206206
/**
207207
* to be used in combination with {@link FieldType#Dense_Vector}
208208
*
209-
* @since 5.3.1
209+
* @since 5.4
210210
*/
211211
KnnSimilarity knnSimilarity() default KnnSimilarity.DEFAULT;
212212

213213
/**
214214
* to be used in combination with {@link FieldType#Dense_Vector}
215215
*
216-
* @since 5.3.1
216+
* @since 5.4
217217
*/
218218
KnnIndexOptions[] knnIndexOptions() default {};
219219

src/main/java/org/springframework/data/elasticsearch/annotations/FieldElementType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
/**
1919
* @author Haibo Liu
20-
* @since 5.3.1
20+
* @since 5.4
2121
*/
2222
public final class FieldElementType {
2323
public final static String DEFAULT = "";

src/main/java/org/springframework/data/elasticsearch/annotations/InnerField.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,21 +154,21 @@
154154
/**
155155
* to be used in combination with {@link FieldType#Dense_Vector}
156156
*
157-
* @since 5.3.1
157+
* @since 5.4
158158
*/
159159
String elementType() default FieldElementType.DEFAULT;
160160

161161
/**
162162
* to be used in combination with {@link FieldType#Dense_Vector}
163163
*
164-
* @since 5.3.1
164+
* @since 5.4
165165
*/
166166
KnnSimilarity knnSimilarity() default KnnSimilarity.DEFAULT;
167167

168168
/**
169169
* to be used in combination with {@link FieldType#Dense_Vector}
170170
*
171-
* @since 5.3.1
171+
* @since 5.4
172172
*/
173173
KnnIndexOptions[] knnIndexOptions() default {};
174174
}

src/main/java/org/springframework/data/elasticsearch/annotations/KnnAlgorithmType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
/**
1919
* @author Haibo Liu
20-
* @since 5.3.1
20+
* @since 5.4
2121
*/
2222
public enum KnnAlgorithmType {
2323
HNSW("hnsw"),

src/main/java/org/springframework/data/elasticsearch/annotations/KnnIndexOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
/**
1919
* @author Haibo Liu
20-
* @since 5.3.1
20+
* @since 5.4
2121
*/
2222
public @interface KnnIndexOptions {
2323

src/main/java/org/springframework/data/elasticsearch/annotations/KnnSimilarity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
/**
1919
* @author Haibo Liu
20-
* @since 5.3.1
20+
* @since 5.4
2121
*/
2222
public enum KnnSimilarity {
2323
L2_NORM("l2_norm"),

src/main/java/org/springframework/data/elasticsearch/client/elc/NativeQueryBuilder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ public NativeQueryBuilder withQuery(org.springframework.data.elasticsearch.core.
213213
return this;
214214
}
215215

216+
/**
217+
* @since 5.4
218+
*/
216219
public NativeQueryBuilder withKnnSearches(List<KnnSearch> knnSearches) {
217220
this.knnSearches = knnSearches;
218221
return this;

0 commit comments

Comments
 (0)