{"record":{"id":"8de4f5f7359e54a0","repo":"elastic/elasticsearch","slug":"bitmap-terms-requires-a-value","errorCode":null,"errorMessage":"[bitmap_terms] requires a [value]","messagePattern":"\\[bitmap_terms\\] requires a \\[value\\]","errorType":"validation","errorClass":"ParsingException","httpStatus":400,"severity":"error","filePath":"modules/bitmap/src/main/java/org/elasticsearch/index/query/bitmapterms/BitmapTermsQueryBuilder.java","lineNumber":139,"sourceCode":"                    queryName = parser.text();\n                } else {\n                    throw new ParsingException(\n                        parser.getTokenLocation(),\n                        \"[\" + NAME + \"] query does not support [\" + currentFieldName + \"]\"\n                    );\n                }\n            } else {\n                throw new ParsingException(\n                    parser.getTokenLocation(),\n                    \"[\" + NAME + \"] unknown token [\" + token + \"] after [\" + currentFieldName + \"]\"\n                );\n            }\n        }\n        if (fieldName == null) {\n            throw new ParsingException(parser.getTokenLocation(), \"[\" + NAME + \"] requires a [field]\");\n        }\n        if (value == null) {\n            throw new ParsingException(parser.getTokenLocation(), \"[\" + NAME + \"] requires a [value]\");\n        }\n        return new BitmapTermsQueryBuilder(fieldName, value).boost(boost).queryName(queryName);\n    }\n\n    @Override\n    public String getWriteableName() {\n        return NAME;\n    }\n\n    @Override\n    protected Query doToQuery(SearchExecutionContext context) throws IOException {\n        MappedFieldType fieldType = context.getFieldType(fieldName);\n        if (!(fieldType instanceof NumberFieldMapper.NumberFieldType numberFieldType)\n            || (numberFieldType.numberType() != NumberFieldMapper.NumberType.INTEGER\n                && numberFieldType.numberType() != NumberFieldMapper.NumberType.LONG)\n            || (numberFieldType.isIndexedWithPoints() == false && numberFieldType.isIndexedWithTerms() == false)) {\n            throw new IllegalArgumentException(\n                \"[bitmap_terms] query is not supported on field [\"","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/bitmap/src/main/java/org/elasticsearch/index/query/bitmapterms/BitmapTermsQueryBuilder.java#L121-L157","documentation":"Thrown after parsing completes if no \"value\" key was supplied. The value must be a base64-encoded serialized RoaringBitmap; its absence is caught post-parse as a ParsingException.","triggerScenarios":"Sending `{\"bitmap_terms\":{\"field\":\"uid\"}}` with no value, or an empty body. Any body missing the \"value\" key triggers it after the parse loop.","commonSituations":"Computing the bitmap client-side and forgetting to attach it; serialization bug that yields an empty value string is NOT this error (empty string is non-null and passes here, failing later at base64 decode).","solutions":["Add the \"value\" key with a base64-encoded serialized RoaringBitmap.","Confirm the client serialization pipeline actually populates the value before issuing the query."],"exampleFix":"// before\n{\"bitmap_terms\":{\"field\":\"uid\"}}\n// after\n{\"bitmap_terms\":{\"field\":\"uid\",\"value\":\"PGJpdG1hcD4=\"}}","handlingStrategy":"validation","validationCode":"if (!body.value || typeof body.value !== \"string\") {\n  throw new Error(\"bitmap_terms requires a [value]\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run the bitmap serialization to completion before attaching the value.","Assert the value is a non-empty base64 string prior to send."],"tags":["bitmap-terms","query-dsl","parsing","elasticsearch"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}