Skip to content

Commit aeabfc5

Browse files
author
Sean Sullivan
committed
Pass the field type from the from end because cross cluster get_field_type doesn't work
1 parent 4d44217 commit aeabfc5

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ The API is currently provisional and may change in future releases.
140140
* `geopoint_field=[alphanumeric]` : the field to use for geopoint coordinates.
141141

142142
**Optional:**
143-
143+
* `geopfield_type=[alphanumeric]` : the field type to use for the query (default: `geo_point`) this is needed because crosscluster get_field_mapping doesn't work
144144
* `timestamp_field=[string]` : the field to use for time (default: `@timestamp`)
145145
* `params=[json]` : query/filter parameters from kibana.
146146
* `cmap=[alphanumeric]` : the colorcet map to use (default: `bmy` for heatmap and `glasbey_category10` for colored points)

elastic_datashader/parameters.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def create_default_params() -> Dict[str, Any]:
3636
"ellipse_units": "",
3737
"filter_distance": None,
3838
"geopoint_field": None,
39+
'geofield_type': 'geo_point',
3940
"highlight": None,
4041
"lucene_query": None,
4142
"max_batch": config.max_batch,
@@ -291,6 +292,7 @@ def extract_parameters(headers: Dict[Any, Any], query_params: Dict[Any, Any]) ->
291292
params["cmap"] = get_cmap(query_params.get("cmap", None), category_field)
292293
params["span_range"] = query_params.get("span", "auto")
293294
params["geopoint_field"] = query_params.get("geopoint_field", params["geopoint_field"])
295+
params["geofield_type"] = query_params.get("geofield_type", params["geofield_type"])
294296
params["timestamp_field"] = query_params.get("timestamp_field", params["timestamp_field"])
295297
params.update(get_time_bounds(now, from_time, to_time))
296298
params["bucket_min"] = float(query_params.get("bucket_min", 0))
@@ -346,7 +348,8 @@ def generate_global_params(headers, params, idx):
346348
if category_type == "number":
347349
bounds_s.aggs.metric("field_stats", "stats", field=category_field)
348350

349-
field_type = get_field_type(config.elastic_hosts, headers, params, geopoint_field, idx)
351+
# field_type = get_field_type(config.elastic_hosts, headers, params, geopoint_field, idx)
352+
field_type = params["geofield_type"] # CCS you cannot get mappings so we needed to push the field type from the client side
350353
# Execute and process search
351354
if len(list(bounds_s.aggs)) > 0 and field_type != "geo_shape":
352355
logger.info(bounds_s.to_dict())

elastic_datashader/tilegen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
)
3333
from .elastic import (
3434
parse_duration_interval,
35-
get_field_type,
3635
get_search_base,
3736
convert_composite,
3837
split_fieldname_to_list,
@@ -1099,7 +1098,8 @@ def generate_tile(idx, x, y, z, headers, params, tile_width_px=256, tile_height_
10991098

11001099
# the composite needs one bin for 'after_key'
11011100
composite_agg_size = int(max_bins / inner_agg_size) - 1
1102-
field_type = get_field_type(config.elastic_hosts, headers, params, geopoint_field, idx)
1101+
# field_type = get_field_type(config.elastic_hosts, headers, params, geopoint_field, idx)
1102+
field_type = params["geofield_type"] # CCS you cannot get mappings so we needed to push the field type from the client side
11031103
partial_data = False # TODO can we get partial data?
11041104
span = None
11051105
if field_type == "geo_point":

0 commit comments

Comments
 (0)