{"record":{"id":"f6053e5dffb1f596","repo":"elastic/elasticsearch","slug":"bitmap-terms-query-does-not-support","errorCode":null,"errorMessage":"[bitmap_terms] query does not support [{}]","messagePattern":"\\[bitmap_terms\\] query does not support \\[(.+?)\\]","errorType":"validation","errorClass":"ParsingException","httpStatus":400,"severity":"error","filePath":"modules/bitmap/src/main/java/org/elasticsearch/index/query/bitmapterms/BitmapTermsQueryBuilder.java","lineNumber":123,"sourceCode":"        float boost = DEFAULT_BOOST;\n        String queryName = null;\n\n        XContentParser.Token token;\n        String currentFieldName = null;\n        while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {\n            if (token == XContentParser.Token.FIELD_NAME) {\n                currentFieldName = parser.currentName();\n            } else if (token.isValue()) {\n                if (\"field\".equals(currentFieldName)) {\n                    fieldName = parser.text();\n                } else if (\"value\".equals(currentFieldName)) {\n                    value = parser.text();\n                } else if (BOOST_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {\n                    boost = parser.floatValue();\n                } else if (NAME_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {\n                    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);","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/bitmap/src/main/java/org/elasticsearch/index/query/bitmapterms/BitmapTermsQueryBuilder.java#L105-L141","documentation":"Thrown by BitmapTermsQueryBuilder.fromXContent when the query JSON body contains a field name other than the four supported ones (field, value, boost, _name). The parser walks the object and rejects any unrecognized key at parse time, before any query execution. This is the standard Elasticsearch mechanism for surfacing typos or unsupported options in a query DSL body.","triggerScenarios":"Issuing a `bitmap_terms` query whose JSON includes an unsupported key, e.g. `{\"bitmap_terms\":{\"field\":\"f\",\"value\":\"...\",\"minimum_should_match\":1}}` or a typo like `\"feild\"`. Any key not literally \"field\", \"value\", \"boost\", or \"_name\" reaches this throw.","commonSituations":"Copy-pasting a terms/terms_set query body and assuming bitmap_terms shares options; auto-generating query JSON with a schema that drifts from the supported set; typos in field names produced by template engines.","solutions":["Remove the unsupported key from the bitmap_terms body; only field, value, boost, and _name are accepted.","Re-check the query against the BitmapTermsQueryBuilder Javadoc / doXContent output which serializes exactly field, value, boost, _name.","If you need scoring control, use the supported boost / _name rather than other query options."],"exampleFix":"// before\n{\"bitmap_terms\":{\"field\":\"uid\",\"value\":\"PGJpdG1hcD4=\",\"minimum_should_match\":1}}\n// after\n{\"bitmap_terms\":{\"field\":\"uid\",\"value\":\"PGJpdG1hcD4=\",\"boost\":1.0}}","handlingStrategy":"validation","validationCode":"// Validate the bitmap_terms query body keys before sending.\nconst ALLOWED = new Set([\"field\", \"value\", \"boost\", \"_name\"]);\nfunction validateBitmapTerms(body) {\n  for (const k of Object.keys(body)) {\n    if (!ALLOWED.has(k)) throw new Error(`bitmap_terms does not support [${k}]`);\n  }\n  if (typeof body.field !== \"string\") throw new Error(\"field must be a string\");\n  if (typeof body.value !== \"string\") throw new Error(\"value must be a string\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate bitmap_terms bodies from the official QueryBuilder rather than hand-rolling JSON.","Keep an allow-list of supported keys (field, value, boost, _name) and lint against it."],"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"}