-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed SearchAfter field type to FieldValue instead of String (#769)
* Changed SearchAfter of SearchRequest type to FieldValue instead of String Signed-off-by: channel-dante <[email protected]> * apply spotlessApply Signed-off-by: channel-dante <[email protected]> * move log from 2.x to 3.0 on changelog Signed-off-by: channel-dante <[email protected]> * add UPGRADING.md Signed-off-by: channel-dante <[email protected]> * update UPGRADING.md Signed-off-by: channel-dante <[email protected]> --------- Signed-off-by: channel-dante <[email protected]>
- Loading branch information
1 parent
3f9a00c
commit 3738026
Showing
4 changed files
with
44 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# UPGRADING | ||
|
||
## [UPGRADING 2.x to 3.0] | ||
### SearchAfter of SearchRequest type | ||
- Changed SearchAfter of SearchRequest type to FieldValue instead of String ([#769](https://github.com/opensearch-project/opensearch-java/pull/769)) | ||
- Consider using `FieldValue.of` to make string type values compatible. | ||
|
||
Before: | ||
``` | ||
.searchAfter("string") | ||
.searchAfter("string1", "string2") | ||
.searchAfter(List.of("String")) | ||
``` | ||
|
||
After: | ||
``` | ||
.searchAfter(FieldValue.of("string")) | ||
.searchAfter(FieldValue.of("string1"), FieldValue.of("string2")) | ||
.searchAfter(List.of(FieldValue.of("String"))) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
java-client/src/test/java/org/opensearch/client/opensearch/core/SearchRequestTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.opensearch.client.opensearch.core; | ||
|
||
import org.junit.Test; | ||
import org.opensearch.client.opensearch._types.FieldValue; | ||
import org.opensearch.client.opensearch.model.ModelTestCase; | ||
|
||
public class SearchRequestTest extends ModelTestCase { | ||
@Test | ||
public void afterSearch() { | ||
SearchRequest request = new SearchRequest.Builder().searchAfter(FieldValue.of(1), FieldValue.of("string")).build(); | ||
|
||
assertEquals("{\"search_after\":[1,\"string\"]}", toJson(request)); | ||
} | ||
} |