diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml new file mode 100644 index 000000000..10a9e1a45 --- /dev/null +++ b/.github/workflows/auto-release.yml @@ -0,0 +1,28 @@ +name: Releases + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: GitHub App token + id: github_app_token + uses: tibdex/github-app-token@v1.5.0 + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_PRIVATE_KEY }} + installation_id: 22958780 + - name: Get tag + id: tag + uses: dawidd6/action-get-tag@v1 + - uses: actions/checkout@v2 + - uses: ncipollo/release-action@v1 + with: + github_token: ${{ steps.github_app_token.outputs.token }} + bodyFile: release-notes/opensearch-neural-search.release-notes-${{steps.tag.outputs.tag}}.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 744ff88b7..f31d25198 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Enhancements ### Bug Fixes ### Infrastructure -* Bump gradle version to 8.1.1 ([#169](https://github.com/opensearch-project/neural-search/pull/169)) ### Documentation ### Maintenance ### Refactoring \ No newline at end of file diff --git a/release-notes/opensearch-neural-search.release-notes-2.8.0.0.md b/release-notes/opensearch-neural-search.release-notes-2.8.0.0.md new file mode 100644 index 000000000..378ee856b --- /dev/null +++ b/release-notes/opensearch-neural-search.release-notes-2.8.0.0.md @@ -0,0 +1,7 @@ +## Version 2.8.0.0 Release Notes + +Compatible with OpenSearch 2.8.0 + +### Infrastructure + +* Bump gradle version to 8.1.1 ([#169](https://github.com/opensearch-project/neural-search/pull/169)) diff --git a/release-notes/opensearch-neural-search.release-notes-2.9.0.0.md b/release-notes/opensearch-neural-search.release-notes-2.9.0.0.md new file mode 100644 index 000000000..63f70dd75 --- /dev/null +++ b/release-notes/opensearch-neural-search.release-notes-2.9.0.0.md @@ -0,0 +1,9 @@ +## Version 2.9.0.0 Release Notes + +Compatible with OpenSearch 2.9.0 + +### Maintenance +Increment version to 2.9.0-SNAPSHOT ([#191](https://github.com/opensearch-project/neural-search/pull/191)) + +### Bug Fixes +Fix update document with knnn_vector size not matching issue ([#208](https://github.com/opensearch-project/neural-search/pull/208)) diff --git a/src/main/java/org/opensearch/neuralsearch/processor/TextEmbeddingProcessor.java b/src/main/java/org/opensearch/neuralsearch/processor/TextEmbeddingProcessor.java index 736fecafc..482a8730c 100644 --- a/src/main/java/org/opensearch/neuralsearch/processor/TextEmbeddingProcessor.java +++ b/src/main/java/org/opensearch/neuralsearch/processor/TextEmbeddingProcessor.java @@ -105,7 +105,7 @@ public void execute(IngestDocument ingestDocument, BiConsumer { - appendVectorFieldsToDocument(ingestDocument, knnMap, vectors); + setVectorFieldsToDocument(ingestDocument, knnMap, vectors); handler.accept(ingestDocument, null); }, e -> { handler.accept(null, e); })); } @@ -115,11 +115,11 @@ public void execute(IngestDocument ingestDocument, BiConsumer knnMap, List> vectors) { + void setVectorFieldsToDocument(IngestDocument ingestDocument, Map knnMap, List> vectors) { Objects.requireNonNull(vectors, "embedding failed, inference returns null result!"); log.debug("Text embedding result fetched, starting build vector output!"); Map textEmbeddingResult = buildTextEmbeddingResult(knnMap, vectors, ingestDocument.getSourceAndMetadata()); - textEmbeddingResult.forEach(ingestDocument::appendFieldValue); + textEmbeddingResult.forEach(ingestDocument::setFieldValue); } @SuppressWarnings({ "unchecked" }) diff --git a/src/test/java/org/opensearch/neuralsearch/common/BaseNeuralSearchIT.java b/src/test/java/org/opensearch/neuralsearch/common/BaseNeuralSearchIT.java index 02f9f8c9f..f4daed549 100644 --- a/src/test/java/org/opensearch/neuralsearch/common/BaseNeuralSearchIT.java +++ b/src/test/java/org/opensearch/neuralsearch/common/BaseNeuralSearchIT.java @@ -677,5 +677,4 @@ protected String getDeployedModelId() { assertEquals(1, modelIds.size()); return modelIds.iterator().next(); } - } diff --git a/src/test/java/org/opensearch/neuralsearch/processor/TextEmbeddingProcessorTests.java b/src/test/java/org/opensearch/neuralsearch/processor/TextEmbeddingProcessorTests.java index d4a92f103..b406030f0 100644 --- a/src/test/java/org/opensearch/neuralsearch/processor/TextEmbeddingProcessorTests.java +++ b/src/test/java/org/opensearch/neuralsearch/processor/TextEmbeddingProcessorTests.java @@ -350,7 +350,7 @@ public void testProcessResponse_successful() throws Exception { Map knnMap = processor.buildMapWithKnnKeyAndOriginalValue(ingestDocument); List> modelTensorList = createMockVectorResult(); - processor.appendVectorFieldsToDocument(ingestDocument, knnMap, modelTensorList); + processor.setVectorFieldsToDocument(ingestDocument, knnMap, modelTensorList); assertEquals(12, ingestDocument.getSourceAndMetadata().size()); } @@ -398,6 +398,20 @@ public void testBuildVectorOutput_withNestedMap_successful() { assertNotNull(actionGamesKnn); } + public void test_updateDocument_appendVectorFieldsToDocument_successful() { + Map config = createPlainStringConfiguration(); + IngestDocument ingestDocument = createPlainIngestDocument(); + TextEmbeddingProcessor processor = createInstanceWithNestedMapConfiguration(config); + Map knnMap = processor.buildMapWithKnnKeyAndOriginalValue(ingestDocument); + List> modelTensorList = createMockVectorResult(); + processor.setVectorFieldsToDocument(ingestDocument, knnMap, modelTensorList); + + List> modelTensorList1 = createMockVectorResult(); + processor.setVectorFieldsToDocument(ingestDocument, knnMap, modelTensorList1); + assertEquals(12, ingestDocument.getSourceAndMetadata().size()); + assertEquals(2, ((List) ingestDocument.getSourceAndMetadata().get("oriKey6_knn")).size()); + } + private List> createMockVectorResult() { List> modelTensorList = new ArrayList<>(); List number1 = ImmutableList.of(1.234f, 2.354f); diff --git a/src/test/java/org/opensearch/neuralsearch/query/NeuralQueryIT.java b/src/test/java/org/opensearch/neuralsearch/query/NeuralQueryIT.java index afe3226c8..2e1fb670a 100644 --- a/src/test/java/org/opensearch/neuralsearch/query/NeuralQueryIT.java +++ b/src/test/java/org/opensearch/neuralsearch/query/NeuralQueryIT.java @@ -58,6 +58,17 @@ public void tearDown() { findDeployedModels().forEach(this::deleteModel); } + @After + @SneakyThrows + public void tearDown() { + super.tearDown(); + /* this is required to minimize chance of model not being deployed due to open memory CB, + * this happens in case we leave model from previous test case. We use new model for every test, and old model + * can be undeployed and deleted to free resources after each test case execution. + */ + deleteModel(modelId.get()); + } + /** * Tests basic query: * {