{"record":{"id":"eaeeda10817a5c55","repo":"pentaho/pentaho-kettle","slug":"elasticsearchbulk-log-exception","errorCode":"ElasticSearchBulk.Log.Exception","errorMessage":"ElasticSearchBulk.Log.Exception","messagePattern":"ElasticSearchBulk\\.Log\\.Exception","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/elasticsearch-bulk-insert/core/src/main/java/org/pentaho/di/trans/steps/elasticsearchbulk/ElasticSearchBulk.java","lineNumber":139,"sourceCode":"\n    if ( first ) {\n      first = false;\n      setupData();\n      currentRequest = client.prepareBulk();\n      requestsBuffer = new ArrayList<IndexRequestBuilder>( this.batchSize );\n      initFieldIndexes();\n    }\n\n    try {\n      data.inputRowBuffer[data.nextBufferRowIdx++] = rowData;\n      return indexRow( data.inputRowMeta, rowData ) || !stopOnError;\n    } catch ( KettleStepException e ) {\n      throw e;\n    } catch ( Exception e ) {\n      rejectAllRows( e.getLocalizedMessage() );\n      String msg = BaseMessages.getString( PKG, \"ElasticSearchBulk.Log.Exception\", e.getLocalizedMessage() );\n      logError( msg );\n      throw new KettleStepException( msg, e );\n    }\n  }\n\n  /**\n   * Initialize <code>this.data</code>\n   *\n   * @throws KettleStepException\n   */\n  private void setupData() throws KettleStepException {\n    data.nextBufferRowIdx = 0;\n    data.inputRowMeta = getInputRowMeta().clone(); // only available after first getRow();\n    data.inputRowBuffer = new Object[batchSize][];\n    data.outputRowMeta = data.inputRowMeta.clone();\n    meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,\n                    metaStore );\n  }\n\n  private void initFieldIndexes() throws KettleStepException {","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/elasticsearch-bulk-insert/core/src/main/java/org/pentaho/di/trans/steps/elasticsearchbulk/ElasticSearchBulk.java#L121-L157","documentation":"ElasticSearchBulk.processRow rejects all incoming rows and throws a KettleStepException wrapping this message whenever any unexpected exception occurs while processing a row against Elasticsearch (after rethrowing KettleStepException untouched). The message includes the original exception's localized text, so it is a generic failure wrapper for the step's row loop.","triggerScenarios":"Any non-KettleStepException thrown in processRow: transport/client failures, mapping errors, null or malformed row data, document parsing errors during bulk indexing.","commonSituations":"Elasticsearch cluster unreachable or returning errors; field mapping conflicts; rows whose JSON field content is invalid; wrong index/document type configuration.","solutions":["Read e.getLocalizedMessage() embedded in msg for the root cause","Verify Elasticsearch host/port/cluster settings and that the cluster is reachable","Check the index mapping against the fields being sent","Enable step logging / run with a sample of rows to find the offending row"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// preview the stream and confirm JSON field content is valid before the step\nObject raw = row[jsonFieldIdx];\nif (raw == null) throw new KettleStepException(\"JSON field is null in input row\");\nnew JSONObject(raw.toString()); // throws if not valid JSON","typeGuard":null,"tryCatchPattern":"try { processRow flows via step error handling } catch (KettleStepException e) { logError(\"ES bulk row error: \" + e.getLocalizedMessage(), e); }","preventionTips":["Verify ES cluster connectivity and index mappings before production runs","Validate the JSON field contents upstream (e.g. JSON Input / User Defined Java)","Use step error handling rows to capture rejected rows for diagnosis","Keep elasticsearch-bulk-insert plugin version aligned with your ES version"],"tags":["elasticsearch","pdi","step","runtime"],"backgroundTag":"http-error-response","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}