Skip to content

Commit f2c7b52

Browse files
author
Sean Sullivan
committed
Fix bug where controls make red x
1 parent 4fca38c commit f2c7b52

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

elastic_datashader/elastic.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,13 @@ def build_dsl_filter(filter_inputs) -> Optional[Dict[str, Any]]:
371371
filter_dict["filter"].append({filter_key: f.get(filter_key)})
372372

373373
else:
374-
raise ValueError("unsupported filter type {}".format(f.get("meta").get("type"))) # pylint: disable=C0209
374+
# Here we handle filters that don't send a type (this happens when controls send filters)
375+
# example filters[{"meta":{"index":"11503c28-7d88-4f9a-946b-2997a5ea64cf","key":"name"},"query":{"match_phrase":{"name":"word_5"}}}]
376+
if f.get("meta", {}).get("negate"):
377+
filter_dict["must_not"].append(f.get("query"))
378+
else:
379+
filter_dict["filter"].append(f.get("query"))
380+
# raise ValueError("unsupported filter type {}".format(f.get("meta").get("type"))) # pylint: disable=C0209
375381

376382
logger.info("Filter output %s", filter_dict)
377383
return filter_dict

0 commit comments

Comments
 (0)