Skip to content

Commit b07f5df

Browse files
author
Sean Sullivan
committed
Handle mandrill nested mappings
1 parent aa1ce46 commit b07f5df

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

elastic_datashader/elastic.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,11 @@ def get_field_type(elastic_hosts: str, headers: Optional[str], params: Dict[str,
172172
mappings = es.indices.get_field_mapping(fields=field, index=idx)
173173
# {'foot_prints': {'mappings': {'foot_print': {'full_name': 'foot_print', 'mapping': {'foot_print': {'type': 'geo_shape'}}}}}}
174174
index = list(mappings.keys())[0] # if index is my_index* it comes back as my_index
175-
return mappings[index]['mappings'][field]['mapping'][field]['type']
175+
field_parts = field.split(".")
176+
try:
177+
return mappings[index]['mappings'][field]['mapping'][field_parts[-1]]['type'] # handles 'geo_center' or a nested object {signal:{geo:{location:{}}}}
178+
except:
179+
return mappings[index]['mappings'][field]['mapping'][field]['type'] # handles literal string with periods 'signal.geo.location'
176180

177181
def get_search_base(
178182
elastic_hosts: str,

0 commit comments

Comments
 (0)