Generating embeddings for arrays of objects

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
opensearch 2.19

Describe the issue:
i follow this tutorial.but output result not same i get

but i got

Configuration:

Relevant Logs or Screenshots:

Hi @Arun!

I have to say, it’s not a lot to go on without seeing how you completed each step. Any chance you can share the mappings of your index and your payloads in creating the ingest pipeline and how you associated it with a model ID?

1 Like

hai @nateynate this my payloads

PUT my_books
{
  "settings" : {
      "index.knn" : "true",
      "default_pipeline": "bedrock_embedding_foreach_pipeline",
      "index.knn.space_type": "cosinesimil"
  },
  "mappings": {
    "properties": {
      "books": {
        "type": "nested",
        "properties": {
          "title_embedding": {
            "type": "knn_vector",
            "dimension": 768
          },
          "title": {
            "type": "text"
          },
          "description": {
            "type": "text"
          }
        }
      }
    }
  }
}
PUT _ingest/pipeline/bedrock_embedding_pipeline
{
  "processors": [
    {
      "set": {
        "field": "temp_title",
        "value": "{{ _ingest._value.title }}"
      }
    },
    {
      "text_embedding": {
        "model_id": "GsR3LZUB6qjJr3Iuo7oe",
        "field_map": {
          "temp_title": "_ingest._value.title_embedding"
        },
         "batch_size" : 200
      }
    },
    {
      "remove": {
        "field": "temp_title"
      }
    }
  ]
}

PUT _ingest/pipeline/bedrock_embedding_foreach_pipeline
{
  "description": "Test nested embeddings",
  "processors": [
    
    {
      "foreach": {
        "field": "books",
        "processor": {
          "pipeline": {
            "name": "bedrock_embedding_pipeline"
          }
        },
        "ignore_failure": true
      }
    }
  ]
}
POST _ingest/pipeline/bedrock_embedding_foreach_pipeline/_simulate
{
  "docs": [
    {
      "_index": "my_books",
      "_id": "1",
      "_source": {
        "books": [
          {
            "title": "first book",
            "description": "This is first book"
          },
          {
            "title": "second book",
            "description": "This is second book"
          }
        ]
      }
    }
  ]
}`

_ingest._value.title_embedding creating new property in top level