Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(opensearch): handle empty free-text query search in global search (#6685)

Sandeep Kumarb1cdff0950f3
diff --git a/crates/analytics/src/opensearch.rs b/crates/analytics/src/opensearch.rs
index 84a2b9db3d..e8726840a2 100644
--- a/crates/analytics/src/opensearch.rs
+++ b/crates/analytics/src/opensearch.rs
@@ -510,14 +510,15 @@ impl OpenSearchQueryBuilder {
case_sensitive_filters: Vec<&(String, Vec<String>)>,
) -> Vec<Value> {
let mut filter_array = Vec::new();
-
- filter_array.push(json!({
- "multi_match": {
- "type": "phrase",
- "query": self.query,
- "lenient": true
- }
- }));
+ if !self.query.is_empty() {
+ filter_array.push(json!({
+ "multi_match": {
+ "type": "phrase",
+ "query": self.query,
+ "lenient": true
+ }
+ }));
+ }
let case_sensitive_json_filters = case_sensitive_filters
.into_iter()