{"record":{"id":"98f2a1580ee4fc3c","repo":"elastic/elasticsearch","slug":"is-not-a-boolean-value-cannot-convert-to-boo","errorCode":null,"errorMessage":"[{}] is not a boolean value, cannot convert to boolean","messagePattern":"\\[(.+?)\\] is not a boolean value, cannot convert to boolean","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/ConvertProcessor.java","lineNumber":90,"sourceCode":"        FLOAT {\n            @Override\n            public Object convert(Object value) {\n                try {\n                    return Float.parseFloat(value.toString());\n                } catch (NumberFormatException e) {\n                    throw new IllegalArgumentException(\"unable to convert [\" + value + \"] to float\", e);\n                }\n            }\n        },\n        BOOLEAN {\n            @Override\n            public Object convert(Object value) {\n                if (value.toString().equalsIgnoreCase(\"true\")) {\n                    return true;\n                } else if (value.toString().equalsIgnoreCase(\"false\")) {\n                    return false;\n                } else {\n                    throw new IllegalArgumentException(\"[\" + value + \"] is not a boolean value, cannot convert to boolean\");\n                }\n            }\n        },\n        IP {\n            @Override\n            public Object convert(Object value) {\n                // IllegalArgumentException is thrown if unable to convert\n                InetAddresses.forString((String) value);\n                return value;\n            }\n        },\n        STRING {\n            @Override\n            public Object convert(Object value) {\n                return value.toString();\n            }\n        },\n        AUTO {","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/ConvertProcessor.java#L72-L108","documentation":"Thrown by the ConvertProcessor BOOLEAN constant when the field value's string form is not case-insensitively equal to 'true' or 'false'. Unlike numeric conversions there is no underlying parse exception; the processor explicitly checks only those two literals and rejects everything else (including '1'/'0', 'yes'/'no', 'Y'/'N'). It fires during pipeline execution while converting a field to boolean.","triggerScenarios":"A 'convert' processor with 'type: boolean' is run on a document whose target field is '1', '0', 'yes', 'no', 'Y', 't', 'enabled', or any value other than the literal strings 'true'/'false'.","commonSituations":"Migrating from a system that serializes booleans as 0/1 integers; CSV/log ingest where flags are Y/N; JSON producers that emit 'Yes'; legacy fields using 'ENABLED'/'DISABLED'.","solutions":["Normalize the field with a preceding 'gsub' or 'script' processor so the value is exactly 'true' or 'false' before the convert step.","Use a 'script' processor with painless logic (e.g. ctx.flag = ['1','yes','y','true'].contains(ctx.flag?.toLowerCase()) ) as a replacement for convert.","Correct the producing application to emit JSON booleans (true/false) rather than strings."],"exampleFix":"// before - field \"active\" = \"yes\"\n{\"convert\": {\"field\": \"active\", \"type\": \"boolean\"}}\n// after - map common truthy strings first\n{\"script\": {\"source\": \"def v = ctx.active?.toString()?.toLowerCase(); ctx.active = (v == '1' || v == 'yes' || v == 'y' || v == 'true') ? 'true' : 'false'\"}},\n{\"convert\": {\"field\": \"active\", \"type\": \"boolean\"}}","handlingStrategy":"validation","validationCode":"// Pre-map common truthy/falsy strings before convert to boolean:\n{\"script\": {\"source\": \"def v = ctx.active?.toString()?.toLowerCase(); if (v != null) { ctx.active = (['1','yes','y','true','on'].contains(v)) ? 'true' : 'false'; }\"}}","typeGuard":"// painless guard\nboolean isBooleanLiteral(def v) { def s = v?.toString()?.toLowerCase(); return 'true'.equals(s) || 'false'.equals(s); }","tryCatchPattern":"// Use pipeline on_failure to quarantine non-boolean values:\n{\"on_failure\": [{\"set\": {\"field\": \"error\", \"value\": \"boolean-convert\"}}, {\"index\": {\"index\": \"ingest-dlq\"}}]}","preventionTips":["Normalize Y/N, 1/0, yes/no upstream to literal 'true'/'false'.","Prefer emitting JSON booleans from the producer when possible.","Document the strict 'true'/'false' rule for pipeline authors."],"tags":["ingest","convert-processor","type-coercion","boolean"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}