From cf7b92076c0d3a3f1473081ec608523ad236d004 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Tue, 12 Nov 2024 15:20:37 +1300 Subject: [PATCH] Fix test Signed-off-by: Thomas Farr --- .../client/opensearch/integTest/AbstractCrudIT.java | 9 +++++---- .../integTest/AbstractMultiSearchRequestIT.java | 3 ++- .../opensearch/client/samples/knn/KnnScriptScore.java | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractCrudIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractCrudIT.java index f83247fa1b..0020a118eb 100644 --- a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractCrudIT.java +++ b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractCrudIT.java @@ -16,6 +16,7 @@ import org.joda.time.DateTimeZone; import org.joda.time.format.DateTimeFormat; import org.opensearch.client.json.JsonData; +import org.opensearch.client.opensearch._types.BuiltinScriptLanguage; import org.opensearch.client.opensearch._types.InlineScript; import org.opensearch.client.opensearch._types.OpenSearchException; import org.opensearch.client.opensearch._types.Refresh; @@ -340,7 +341,7 @@ public void testBulkUpdateScript() throws IOException { .script( Script.of( s -> s.inline( - new InlineScript.Builder().lang("painless") + new InlineScript.Builder().lang(l -> l.builtin(BuiltinScriptLanguage.Painless)) .source("ctx._source.intValue += params.inc") .params("inc", JsonData.of(1)) .build() @@ -374,7 +375,7 @@ public void testBulkUpdateScriptUpsert() throws IOException { .script( Script.of( s -> s.inline( - new InlineScript.Builder().lang("painless") + new InlineScript.Builder().lang(l -> l.builtin(BuiltinScriptLanguage.Painless)) .source("ctx._source.intValue += params.inc") .params("inc", JsonData.of(1)) .build() @@ -411,7 +412,7 @@ public void testBulkUpdateScriptedUpsertUpdate() throws IOException { .script( Script.of( s -> s.inline( - new InlineScript.Builder().lang("painless") + new InlineScript.Builder().lang(l -> l.builtin(BuiltinScriptLanguage.Painless)) .source("ctx._source.intValue = ctx?._source?.intValue == null ? 7777 : 9999") .build() ) @@ -441,7 +442,7 @@ public void testBulkUpdateScriptedUpsertInsert() throws IOException { .script( Script.of( s -> s.inline( - new InlineScript.Builder().lang("painless") + new InlineScript.Builder().lang(l -> l.builtin(BuiltinScriptLanguage.Painless)) .source("ctx._source.intValue = ctx?._source?.intValue == null ? 7777 : 9999") .build() ) diff --git a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractMultiSearchRequestIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractMultiSearchRequestIT.java index 0d35a11f7e..66623566a6 100644 --- a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractMultiSearchRequestIT.java +++ b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractMultiSearchRequestIT.java @@ -20,6 +20,7 @@ import java.util.function.Function; import org.junit.Test; import org.opensearch.client.json.JsonData; +import org.opensearch.client.opensearch._types.BuiltinScriptLanguage; import org.opensearch.client.opensearch._types.FieldSort; import org.opensearch.client.opensearch._types.FieldValue; import org.opensearch.client.opensearch._types.InlineScript; @@ -208,7 +209,7 @@ public void shouldReturnMultiSearchesScriptFields() throws Exception { new ScriptField.Builder().script( Script.of( s -> s.inline( - new InlineScript.Builder().lang("painless") + new InlineScript.Builder().lang(l -> l.builtin(BuiltinScriptLanguage.Painless)) .source("doc['quantity'].value + params.inc") .params("inc", JsonData.of(1)) .build() diff --git a/samples/src/main/java/org/opensearch/client/samples/knn/KnnScriptScore.java b/samples/src/main/java/org/opensearch/client/samples/knn/KnnScriptScore.java index eb0ccec60f..2277db6d13 100644 --- a/samples/src/main/java/org/opensearch/client/samples/knn/KnnScriptScore.java +++ b/samples/src/main/java/org/opensearch/client/samples/knn/KnnScriptScore.java @@ -67,7 +67,7 @@ public static void main(String[] args) { .script( sss -> sss.inline( i -> i.source("knn_score") - .lang("knn") + .lang(l -> l.custom("knn")) .params("field", JsonData.of("values")) .params("query_value", JsonData.of(searchVector)) .params("space_type", JsonData.of("cosinesimil"))