Skip to content

ML Commons Neural Embeddings Tutorial update #9536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions _about/breaking-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@

OpenSearch 2.5 contains a bug fix that corrects the behavior of the `case_insensitive` parameter for the `wildcard` query on text fields. As a result, a wildcard query on text fields that ignored case sensitivity and erroneously returned results prior to the bug fix will not return the same results. For more information, see issue [#8711](https://github.com/opensearch-project/OpenSearch/issues/8711).

## 2.19.0

### Nested value support in the text embedding processor

Check failure on line 48 in _about/breaking-changes.md

View workflow job for this annotation

GitHub Actions / style-job

[vale] reported by reviewdog 🐶 [OpenSearch.StackedHeadings] Do not stack headings. Insert an introductory sentence between headings. Raw Output: {"message": "[OpenSearch.StackedHeadings] Do not stack headings. Insert an introductory sentence between headings.", "location": {"path": "_about/breaking-changes.md", "range": {"start": {"line": 48, "column": 1}}}, "severity": "ERROR"}
The `text_embedding` processor no longer replaces nested values like `_ingest._value` when evaluating fields like `title_tmp:_ingest._value.title_embedding`. Instead, you must directly specify the nested key as `books.title:title_embedding` to achieve the desired output. For more information, see issue [#1243](https://github.com/opensearch-project/neural-search/issues/1243).

## 3.0.0

### JDK requirement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ PUT my_books
{
"settings" : {
"index.knn" : "true",
"default_pipeline": "bedrock_embedding_foreach_pipeline"
"default_pipeline": "bedrock_embedding_pipeline"
},
"mappings": {
"properties": {
Expand Down Expand Up @@ -98,57 +98,21 @@ Then create an inner ingest pipeline to generate an embedding for one array elem

This pipeline contains three processors:

- `set` processor: The `text_embedding` processor is unable to identify the `_ingest._value.title` field. You must copy `_ingest._value.title` to a non-existing temporary field so that the `text_embedding` processor can process it.
- `text_embedding` processor: Converts the value of the temporary field to an embedding.
- `remove` processor: Removes the temporary field.

To create such a pipeline, send the following request:

```json
PUT _ingest/pipeline/bedrock_embedding_pipeline
{
"processors": [
{
"set": {
"field": "title_tmp",
"value": {% raw %}"{{_ingest._value.title}}"{% endraw %}
}
},
{
"text_embedding": {
"model_id": your_embedding_model_id,
"model_id": "your_embedding_model_id",
"field_map": {
"title_tmp": "_ingest._value.title_embedding"
"books.title": "title_embedding"
}
}
},
{
"remove": {
"field": "title_tmp"
}
}
]
}
```
{% include copy-curl.html %}

Create an ingest pipeline with a `foreach` processor that will apply the `bedrock_embedding_pipeline` to each element of the `books` array:

```json
PUT _ingest/pipeline/bedrock_embedding_foreach_pipeline
{
"description": "Test nested embeddings",
"processors": [
{
"foreach": {
"field": "books",
"processor": {
"pipeline": {
"name": "bedrock_embedding_pipeline"
}
},
"ignore_failure": true
}
}
]
}
Expand All @@ -160,7 +124,7 @@ PUT _ingest/pipeline/bedrock_embedding_foreach_pipeline
First, you'll test the pipeline on an array that contains two book objects, both with a `title` field:

```json
POST _ingest/pipeline/bedrock_embedding_foreach_pipeline/_simulate
POST _ingest/pipeline/bedrock_embedding_pipeline/_simulate
{
"docs": [
{
Expand Down
Loading