pentaho/pentaho-kettle · error · KettleStepException

ElasticSearchBulk.Error.NoJsonField

ElasticSearchBulk.Error.NoJsonField

Error message

ElasticSearchBulk.Error.NoJsonField

What it means

initFieldIndexes resolves the configured JSON field name to a column index in the incoming row. If the configured jsonField is not found in the input row layout, it throws KettleStepException 'ElasticSearchBulk.Error.NoJsonField'. The step cannot locate the field containing the JSON document to index.

Solutions

  1. Verify the JSON field name in the step settings matches an incoming field exactly (case-sensitive)
  2. Check any ${variable} used in the field name resolves at runtime
  3. Add/fix the JSON field in the step feeding this one
  4. Preview the input rows to confirm the field exists and its name

Example fix

// before
// Json field: "${JSON_COL}" where JSON_COL is undefined -> field lookup returns null
// after
// define JSON_COL=doc in the transformation's environment settings, or set the literal field name
Defensive patterns

Strategy: validation

Validate before calling

// before running, check the field exists in the input row meta
boolean found = false;
for (ValueMetaInterface vm : inputRowMeta.getValueMetaList()) {
  if (environmentSubstitute(jsonFieldName).equals(vm.getName())) { found = true; break; }
}
if (!found) throw new KettleStepException("Configured JSON field not in stream: " + jsonFieldName);

Try / catch

try { ... } catch (KettleStepException e) { if (e.getMessage().contains("NoJsonField")) { logError("Fix the JSON field setting: " + meta.getJsonField()); } throw e; }

Prevention

When it happens

Trigger: meta.getJsonField() names a field that does not exist in the input stream (getFieldIdx returns null) while isJsonInsert is true.

Common situations: Renamed or removed the JSON field upstream; typo in the field name in the step dialog; variable substitution (environmentSubstitute) resolving to an unexpected name; running the transformation with different input fields than designed.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/721690e41ea7c0fb. Report an issue: GitHub.

Appendix: source

Thrown at plugins/elasticsearch-bulk-insert/core/src/main/java/org/pentaho/di/trans/steps/elasticsearchbulk/ElasticSearchBulk.java:163

   *
   * @throws KettleStepException
   */
  private void setupData() throws KettleStepException {
    data.nextBufferRowIdx = 0;
    data.inputRowMeta = getInputRowMeta().clone(); // only available after first getRow();
    data.inputRowBuffer = new Object[batchSize][];
    data.outputRowMeta = data.inputRowMeta.clone();
    meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,
                    metaStore );
  }

  private void initFieldIndexes() throws KettleStepException {
    if ( isJsonInsert ) {
      Integer idx = getFieldIdx( data.inputRowMeta, environmentSubstitute( meta.getJsonField() ) );
      if ( idx != null ) {
        jsonFieldIdx = idx.intValue();
      } else {
        throw new KettleStepException( BaseMessages.getString( PKG, "ElasticSearchBulk.Error.NoJsonField" ) );
      }
    }

    idOutFieldName = environmentSubstitute( meta.getIdOutField() );

    if ( StringUtils.isNotBlank( meta.getIdInField() ) ) {
      idFieldIndex = getFieldIdx( data.inputRowMeta, environmentSubstitute( meta.getIdInField() ) );
      if ( idFieldIndex == null ) {
        throw new KettleStepException( BaseMessages.getString( PKG, "ElasticSearchBulk.Error.InvalidIdField" ) );
      }
    } else {
      idFieldIndex = null;
    }
  }

  private static Integer getFieldIdx( RowMetaInterface rowMeta, String fieldName ) {
    if ( fieldName == null ) {
      return null;

View on GitHub (pinned to f3058517a1)