{"record":{"id":"3da071d4c08b181a","repo":"elastic/elasticsearch","slug":"field-doesn-t-exist","errorCode":null,"errorMessage":"field [{}] doesn't exist","messagePattern":"field \\[(.+?)\\] doesn't exist","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/KeyValueProcessor.java","lineNumber":147,"sourceCode":"            final String fieldPathPrefix;\n            String keyPrefix = prefix == null ? \"\" : prefix;\n            if (target.isEmpty()) {\n                fieldPathPrefix = keyPrefix;\n            } else {\n                fieldPathPrefix = target + \".\" + keyPrefix;\n            }\n            final Function<String, String> keyPrefixer;\n            if (fieldPathPrefix.isEmpty()) {\n                keyPrefixer = val -> val;\n            } else {\n                keyPrefixer = val -> fieldPathPrefix + val;\n            }\n            String path = document.renderTemplate(field);\n            if (path.isEmpty() || document.hasField(path, true) == false) {\n                if (ignoreMissing) {\n                    return;\n                } else {\n                    throw new IllegalArgumentException(\"field [\" + path + \"] doesn't exist\");\n                }\n            }\n            String value = document.getFieldValue(path, String.class, ignoreMissing);\n            if (value == null) {\n                if (ignoreMissing) {\n                    return;\n                }\n                throw new IllegalArgumentException(\"field [\" + path + \"] is null, cannot extract key-value pairs.\");\n            }\n            for (String part : fieldSplitter.apply(value)) {\n                String[] kv = valueSplitter.apply(part);\n                if (kv.length != 2) {\n                    throw new IllegalArgumentException(\"field [\" + path + \"] does not contain value_split [\" + valueSplit + \"]\");\n                }\n                String key = keyTrimmer.apply(kv[0]);\n                if (keyFilter.test(key)) {\n                    append(document, keyPrefixer.apply(key), valueTrimmer.apply(bracketStrip.apply(kv[1])));\n                }","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/KeyValueProcessor.java#L129-L165","documentation":"Thrown by KeyValueProcessor when the rendered field path is empty or document.hasField(path, true) returns false, and ignoreMissing is false. The kv processor needs an existing field to extract key-value pairs from. IllegalArgumentException surfacing a missing field with the resolved (possibly templated) path in the message.","triggerScenarios":"KV processor field template resolves to empty or to a path that doesn't exist in the document, and ignore_missing=false.","commonSituations":"Field path templated with a context var that is absent; field renamed upstream; pipeline author forgot ignore_missing; sparse source data.","solutions":["Set \"ignore_missing\": true to skip documents without the field.","Verify the field template resolves to an existing path for all documents.","Add an upstream set/rename to guarantee the field exists."],"exampleFix":"// before\n{\"kv\": {\"field\": \"{{log_type}}.raw\", \"field_split\": \" \", \"value_split\": \"=\"}}\n// after\n{\"kv\": {\"field\": \"{{log_type}}.raw\", \"field_split\": \" \", \"value_split\": \"=\", \"ignore_missing\": true}}","handlingStrategy":"validation","validationCode":"String path = document.renderTemplate(field);\nif (path.isEmpty() || !document.hasField(path, true)) {\n    if (!ignoreMissing) {\n        // skip or fix the field template\n    }\n}","typeGuard":"static boolean kvFieldExists(IngestDocument doc, String fieldTemplate) {\n    String path = doc.renderTemplate(fieldTemplate);\n    return !path.isEmpty() && doc.hasField(path, true);\n}","tryCatchPattern":"try {\n    kvProcessor.execute(doc);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"doesn't exist\")) {\n        // route or skip\n    } else throw e;\n}","preventionTips":["Default ignore_missing=true when the field may be absent.","Test field templates against documents with missing template variables.","Ensure upstream processors populate the kv source field."],"tags":["ingest","kv","missing-field","configuration"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}