{"record":{"id":"1ee7510b3e9fa2dd","repo":"FlowiseAI/Flowise","slug":"e-1ee751","errorCode":null,"errorMessage":"${e}","messagePattern":"\\$\\{e\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/vectorstores/Elasticsearch/Elasticsearch.ts","lineNumber":173,"sourceCode":"                    const res = await index({\n                        docsSource: finalDocs,\n                        recordManager,\n                        vectorStore,\n                        options: {\n                            cleanup: recordManager?.cleanup,\n                            sourceIdKey: recordManager?.sourceIdKey ?? 'source',\n                            vectorStoreName: indexName\n                        }\n                    })\n                    await elasticClient.close()\n                    return res\n                } else {\n                    await vectorStore.addDocuments(finalDocs)\n                    await elasticClient.close()\n                    return { numAdded: finalDocs.length, addedDocs: finalDocs }\n                }\n            } catch (e) {\n                throw new Error(e)\n            }\n        },\n        async delete(nodeData: INodeData, ids: string[], options: ICommonObject): Promise<void> {\n            const indexName = nodeData.inputs?.indexName as string\n            const embeddings = nodeData.inputs?.embeddings as Embeddings\n            const similarityMeasure = nodeData.inputs?.similarityMeasure as string\n            const recordManager = nodeData.inputs?.recordManager\n\n            const credentialData = await getCredentialData(nodeData.credential ?? '', options)\n            const endPoint = getCredentialParam('endpoint', credentialData, nodeData)\n            const cloudId = getCredentialParam('cloudId', credentialData, nodeData)\n\n            const { elasticClient, elasticSearchClientArgs } = prepareClientArgs(\n                endPoint,\n                cloudId,\n                credentialData,\n                nodeData,\n                similarityMeasure,","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/vectorstores/Elasticsearch/Elasticsearch.ts#L155-L191","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the ES endpoint or cloudId is reachable and authenticated.","Check the index mapping: dense_vector dims must equal the embedding model's output size.","If similarity measure changed, recreate the index with the correct similarity.","Replace `throw new Error(e)` with `throw e` to retain the ES client error body."],"exampleFix":"// before\n} catch (e) {\n    throw new Error(e)\n}\n\n// after\n} catch (e) {\n    console.error('Elasticsearch upsert failed', e)\n    throw e\n}","handlingStrategy":"try-catch","validationCode":"// verify mapping dims match embedding model\nconst mapping = await elasticClient.indices.getMapping({ index: indexName })\nconst dims = mapping[indexName].mappings.properties?.embedding?.dims\nif (dims && dims !== EMBEDDING_DIM) {\n  throw new Error(`Index dims ${dims} != embedding dim ${EMBEDDING_DIM}`)\n}","typeGuard":"function isEsReachable(client: { ping(): Promise<boolean> }): Promise<boolean> {\n  return client.ping().catch(() => false)\n}","tryCatchPattern":"try {\n  await vectorStore.addDocuments(finalDocs)\n} catch (e) {\n  throw new Error(`ES upsert failed (index=${indexName}): ${e instanceof Error ? e.message : e}`)\n} finally {\n  await elasticClient.close()\n}","preventionTips":["Create the index mapping with the correct dense_vector dims before upsert.","Always close the ES client in a finally block.","Pin the similarity measure for the index lifetime."],"tags":["elasticsearch","vector-store","error-wrapping","network"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}