{"record":{"id":"8a24ac169c3e2711","repo":"quickwit-oss/quickwit","slug":"unsupported-minimum-should-match-dsl-quickwit","errorCode":null,"errorMessage":"Unsupported minimum should match dsl {}. quickwit currently only supports the format '35%' and `-35%`","messagePattern":"Unsupported minimum should match dsl (.+?)\\. quickwit currently only supports the format '35%' and `-35%`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-query/src/elastic_query_dsl/bool_query.rs","lineNumber":65,"sourceCode":"}\n\n// `IgnoredAny` implements `PartialEq` but not `Eq`, so we derive `PartialEq`\n// and manually assert `Eq` (safe because `IgnoredAny` is a unit struct).\nimpl Eq for BoolQuery {}\n\n#[derive(Deserialize, Debug, Eq, PartialEq, Clone)]\n#[serde(untagged)]\npub enum MinimumShouldMatch {\n    Str(String),\n    Int(isize),\n}\n\nimpl MinimumShouldMatch {\n    fn resolve(&self, num_should_clauses: usize) -> anyhow::Result<MinimumShouldMatchResolved> {\n        match self {\n            MinimumShouldMatch::Str(minimum_should_match_dsl) => {\n                let Some(percentage) = parse_percentage(minimum_should_match_dsl) else {\n                    anyhow::bail!(\n                        \"Unsupported minimum should match dsl {}. quickwit currently only \\\n                         supports the format '35%' and `-35%`\",\n                        minimum_should_match_dsl\n                    );\n                };\n                let min_should_match = percentage * num_should_clauses as isize / 100;\n                MinimumShouldMatch::Int(min_should_match).resolve(num_should_clauses)\n            }\n            MinimumShouldMatch::Int(neg_num_missing_should_clauses)\n                if *neg_num_missing_should_clauses < 0 =>\n            {\n                let num_missing_should_clauses = -neg_num_missing_should_clauses as usize;\n                if num_missing_should_clauses >= num_should_clauses {\n                    Ok(MinimumShouldMatchResolved::Unspecified)\n                } else {\n                    Ok(MinimumShouldMatchResolved::Min(\n                        num_should_clauses - num_missing_should_clauses,\n                    ))","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-query/src/elastic_query_dsl/bool_query.rs#L47-L83","documentation":"Elasticsearch-style bool queries accept `minimum_should_match` as a percentage string or combination syntax. Quickwit only supports plain percentage strings like '35%' and negative percentages like '-35%'. Any other DSL string (e.g. '2<75%', combinations '3<90% 2', or bare integers as strings) fails percentage parsing and is rejected.","triggerScenarios":"Submitting a bool query via quickwit-query's Elastic DSL with minimum_should_match set to a Str variant that parse_percentage cannot parse — e.g. '75', '2<-25%', '3<90% 2', '>=3'.","commonSituations":"Porting Elasticsearch queries that use combination or conditional minimum_should_match syntaxes; users writing a bare number as a string expecting absolute-count semantics.","solutions":["Rewrite minimum_should_match as a percentage string ('35%' or '-35%').","Convert combination syntaxes manually: compute the effective count for your clause count and inline the percentage.","Use the integer (NonStr) MinimumShouldMatch variant if an absolute count is needed.","Pre-validate the DSL string with a regex like ^-?\\d+%$ before building the query."],"exampleFix":"// before\n{ \"bool\": { \"minimum_should_match\": \"2<75%\", \"should\": [...] } }\n// after: pre-compute for your clause count\n{ \"bool\": { \"minimum_should_match\": \"75%\", \"should\": [...] } }","handlingStrategy":"validation","validationCode":"fn is_supported_msm(v: &str) -> bool {\n    v.strip_prefix('-').unwrap_or(v).ends_with('%')\n        && v.strip_prefix('-').unwrap_or(v).trim_end_matches('%').parse::<u64>().is_ok()\n}\n// reject before building the query: anyhow::ensure!(is_supported_msm(msm), ...)","typeGuard":null,"tryCatchPattern":"match build_bool_query(dsl) {\n    Err(e) if e.to_string().contains(\"Unsupported minimum should match\") => {\n        // fall back to an explicit should-clause count or default '0%'\n    }\n    other => other,\n}","preventionTips":["Only emit 'N%' or '-N%' forms of minimum_should_match when targeting Quickwit.","Pre-convert Elasticsearch combination syntaxes before sending queries.","Document the supported subset for query-authoring tools."],"tags":["query-dsl","elasticsearch-compat","parsing"],"backgroundTag":"invalid-argument-format","analyzedSha":"a39730c5cdcd1a4fe798403737ae293999ea21f8","analyzedAt":"2026-09-08T13:19:37.784Z","contentChangedAt":"2026-09-08T13:19:37.784Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}