Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'properties' in Elasticsearch query runner #1538

Closed
hgs847825 opened this issue Jan 23, 2017 · 2 comments
Closed

KeyError: 'properties' in Elasticsearch query runner #1538

hgs847825 opened this issue Jan 23, 2017 · 2 comments

Comments

@hgs847825
Copy link
Contributor

Hello,

I encount KeyError: 'properties' in Elasticsearch query runner.
I'm using Bitnami version of Re:dash 0.12.0.2449

Mapping

{
    "tmp_index": {
        "mappings": {
            "_default_": {
                "dynamic_templates": [
                    { ... }
                ]
            },
            "tmp_index": {
                "dynamic_templates": [
                    { ... }
                ],
                "properties": {
                    ...
                }
            }
        }
    }
}

Mappings of "_default_" has no "properties" field.

Work around

--- /opt/redash-0.12.0.2449-0/apps/redash/htdocs/redash/query_runner/elasticsearch.py.old	2017-01-22 17:42:18.008000000 -0500
+++ /opt/redash-0.12.0.2449-0/apps/redash/htdocs/redash/query_runner/elasticsearch.py	2017-01-22 16:52:33.448000000 -0500
@@ -108,6 +108,8 @@
         for index_name in mappings_data:
             index_mappings = mappings_data[index_name]
             for m in index_mappings.get("mappings", {}):
+                if "properties" not in index_mappings["mappings"][m]:
+                    continue
                 for property_name in index_mappings["mappings"][m]["properties"]:
                     property_data = index_mappings["mappings"][m]["properties"][property_name]
                     if not property_name in mappings:

Thanks.

@arikfr
Copy link
Member

arikfr commented Jan 24, 2017

You're welcome to make a pull request with this change 👍

@arikfr
Copy link
Member

arikfr commented Jan 26, 2017

Fixed in #1545.

@arikfr arikfr closed this as completed Jan 26, 2017
dairyo pushed a commit to KiiCorp/redash that referenced this issue Mar 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants