Insert and update documents in OpenSearch

This example pipeline demonstrates how to insert and update records in the OpenSearch database.

  1. Configure the JSON Generator Snap with the required content in the chunk to be passed in the Azure OpenAI Embedder Snap for generating embedding vectors.
    Note: In this example, we use the JSON Generator Snap. However, you can replace the JSON Generator Snap with any Snap of your choice, such as the Chunker, Constant, File Reader, or S3 File Reader Snaps.

    JSON Generator Snap Configuration

  2. Configure the Azure OpenAI Embedder Snap to generate embedding vectors for input data based on the Deployment ID, Batch size, and input document.
    On validation, the input data from the upstream Snap is processed into embedded vectors and you can view the embeddings as vector data in the output preview.
    Azure OpenAI Embedder Snap Configuration Azure OpenAI Embedder Snap Output

    Azure OpenAI Embedder Snap Configuration


    Azure OpenAI Embedder Snap Output

  3. Configure the Mapper Snap with the generated embeddings with $vector, ensuring the embeddings are correctly mapped to the appropriate fields for the subsequent query.

    Mapper Snap Configuration

  4. Configure the OpenSearch Upsert Snap with the Index name and Batch size to insert documents in the specified index.
    Note: The OpenSearch Upsert Snap updates records of the associated object if the record ID exists; otherwise, it creates a new record.

    On validation, the Snap displays a success message for the upserted document, including the ID that is generated for this document.

    OpenSearch Upsert Snap Configuration OpenSearch Upsert Snap Output

    OpenSearch Upsert Snap Configuration


    OpenSearch Upsert Snap Output

To successfully reuse pipelines:
  1. Download and import the pipeline into SnapLogic Platform.
  2. Configure Snap accounts, as applicable.
  3. Provide pipeline parameters, as applicable.