Skip to content

Commit

Permalink
Fix issue where ui on old datashader version sent undefined and custo…
Browse files Browse the repository at this point in the history
…m filter
  • Loading branch information
Sean Sullivan committed Oct 11, 2023
1 parent e3f245b commit 5757d33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions elastic_datashader/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,14 @@ def build_dsl_filter(filter_inputs) -> Optional[Dict[str, Any]]:
filter_key = f.get("meta", {}).get("key")
if f.get("meta", {}).get("negate"):
if filter_key == "query":
filter_dict["must_not"].append({"bool": f.get(filter_key).get("bool")})
filt_index = list(f.get(filter_key))[0]
filter_dict["must_not"].append({filt_index: f.get(filter_key).get(filt_index)})
else:
filter_dict["must_not"].append({filter_key: f.get(filter_key)})
else:
if filter_key == "query":
filter_dict["filter"].append({"bool": f.get(filter_key).get("bool")})
filt_index = list(f.get(filter_key))[0]
filter_dict["must_not"].append({filt_index: f.get(filter_key).get(filt_index)})
else:
filter_dict["filter"].append({filter_key: f.get(filter_key)})

Expand Down
3 changes: 3 additions & 0 deletions elastic_datashader/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ def extract_parameters(headers: Dict[Any, Any], query_params: Dict[Any, Any]) ->
params["timeOverlapSize"] = query_params.get("timeOverlapSize", "auto")
params["debug"] = query_params.get("debug", False) == 'true'

if params["geofield_type"] == "undefined":
params["geofield_type"] = "geo_point"

if params["geopoint_field"] is None:
logger.error("missing geopoint_field")
raise ValueError("missing geopoint_field")
Expand Down

0 comments on commit 5757d33

Please sign in to comment.