Getting Error on creating embedding via code

function to create vector embeddings : -

async getVectorEmbedding(text) {
    try {
      const response = await this.client.ingest.simulate({
        body: {
          pipeline: {
            id: process.env.INGEST_PIPELINE,
          },
          docs: [
            {
              _source: {
                combined_text: text,
              },
            },
          ],
        },
      })

      if (response.body.docs[0].error) {
        console.error('Error in processing document:', response.body.docs[0].error)
        return []
      }

      return response.body.docs[0]._source.vector_embedding
    } catch (err) {
      console.error('Failed to get vector embedding', err.meta.body)
      return []
    }
  }

ingest pipeline :-

{
  "nlp-ingest-pipeline": {
    "description": "A text embedding pipeline",
    "processors": [
      {
        "text_embedding": {
          "model_id": "model_id",
          "field_map": {
            "combined_text": "vector_embedding"
          }
        }
      }
    ]
  }
}

Getting this error :-

{
  error: {
    root_cause: [ [Object] ],
    type: 'parse_exception',
    reason: '[processors] required property is missing',
    property_name: 'processors'
  },
  status: 400
}

Hi @Shubham_Pandey1,

Welcome! Can you confirm that you are using the Elasticsearch JavaScript client? If so, which version are you using?

I assume you are trying to trigger a pipeline you have defined in your Elasticsearch cluster? Can you try having the request options as a single level object, and id as a top level attribute as per the documentation:

try {
      const response = await this.client.ingest.simulate({
          id: '<my_pipeline_id>',
          docs: [
            {
              _source: {
                combined_text: text,
              }
            }
          ]
      })

Let us know if that solves your problem.