FlowiseAI/Flowise · error · Error

${e}

Error message

${e}

What it means

Generic catch-all around the Elasticsearch upsert path covering both the record-manager branch (indexDocuments with sourceIdKey/vectorStoreName, then close client) and the plain addDocuments branch. Wraps ES connection errors, mapping errors, and record-manager errors into a string Error.

Source

Thrown at packages/components/nodes/vectorstores/Elasticsearch/Elasticsearch.ts:173

                    const res = await index({
                        docsSource: finalDocs,
                        recordManager,
                        vectorStore,
                        options: {
                            cleanup: recordManager?.cleanup,
                            sourceIdKey: recordManager?.sourceIdKey ?? 'source',
                            vectorStoreName: indexName
                        }
                    })
                    await elasticClient.close()
                    return res
                } else {
                    await vectorStore.addDocuments(finalDocs)
                    await elasticClient.close()
                    return { numAdded: finalDocs.length, addedDocs: finalDocs }
                }
            } catch (e) {
                throw new Error(e)
            }
        },
        async delete(nodeData: INodeData, ids: string[], options: ICommonObject): Promise<void> {
            const indexName = nodeData.inputs?.indexName as string
            const embeddings = nodeData.inputs?.embeddings as Embeddings
            const similarityMeasure = nodeData.inputs?.similarityMeasure as string
            const recordManager = nodeData.inputs?.recordManager

            const credentialData = await getCredentialData(nodeData.credential ?? '', options)
            const endPoint = getCredentialParam('endpoint', credentialData, nodeData)
            const cloudId = getCredentialParam('cloudId', credentialData, nodeData)

            const { elasticClient, elasticSearchClientArgs } = prepareClientArgs(
                endPoint,
                cloudId,
                credentialData,
                nodeData,
                similarityMeasure,

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Confirm the ES endpoint or cloudId is reachable and authenticated.
  2. Check the index mapping: dense_vector dims must equal the embedding model's output size.
  3. If similarity measure changed, recreate the index with the correct similarity.
  4. Replace `throw new Error(e)` with `throw e` to retain the ES client error body.

Example fix

// before
} catch (e) {
    throw new Error(e)
}

// after
} catch (e) {
    console.error('Elasticsearch upsert failed', e)
    throw e
}
Defensive patterns

Strategy: try-catch

Validate before calling

// verify mapping dims match embedding model
const mapping = await elasticClient.indices.getMapping({ index: indexName })
const dims = mapping[indexName].mappings.properties?.embedding?.dims
if (dims && dims !== EMBEDDING_DIM) {
  throw new Error(`Index dims ${dims} != embedding dim ${EMBEDDING_DIM}`)
}

Type guard

function isEsReachable(client: { ping(): Promise<boolean> }): Promise<boolean> {
  return client.ping().catch(() => false)
}

Try / catch

try {
  await vectorStore.addDocuments(finalDocs)
} catch (e) {
  throw new Error(`ES upsert failed (index=${indexName}): ${e instanceof Error ? e.message : e}`)
} finally {
  await elasticClient.close()
}

Prevention

When it happens

Trigger: Upsert documents into an ES index with configured similarity measure. Fails on unreachable endpoint, invalid cloudId, missing/duplicate index mapping fields, dimension mismatch with the index's dense_vector, or record manager backend errors.

Common situations: endpoint vs cloudId misconfiguration, index mapping's dense_vector dims != embedding dims, similarity measure changed after index creation, or the embedding service failing mid-batch.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/1ee7510b3e9fa2dd. Report an issue: GitHub.