Failed to refresh AWS OpenSearch Data Source

Issue Summary

Gives schema refresh failed error when trying to create query.

Technical details:

Returns 200 from OS:
[2022-09-27 20:35:23,402][PID:41][DEBUG][urllib3.connectionpool] “GET /_mappings HTTP/1.1” 200 None

  • Redash Version: 10.1.0.b50633
  • Browser/OS: Chrome
  • How did you install Redash: Docker

Looks like it’s not handling mappings properly,

@@ -93,8 +94,8 @@ class ElasticSearch2(BaseHTTPQueryRunner):
                 for m in index_mappings.get("mappings", {}):
                     _parse_properties('', index_mappings['mappings'][m]['properties'])
-            except KeyError:
-                _parse_properties('', index_mappings['mappings']['properties'])
+            except (KeyError, TypeError):
+                _parse_properties('', index_mappings['mappings'].get('properties', {}))