{"record":{"id":"1e2a6f5869d65312","repo":"getredash/redash","slug":"advanced-queries-are-not-supported","errorCode":null,"errorMessage":"Advanced queries are not supported","messagePattern":"Advanced queries are not supported","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"redash/query_runner/elasticsearch.py","lineNumber":409,"sourceCode":"            if isinstance(query_data, str):\n                _from = 0\n                while True:\n                    query_size = size if limit >= (_from + size) else (limit - _from)\n                    self._execute_simple_query(\n                        url + \"&size={0}\".format(query_size),\n                        self.auth,\n                        _from,\n                        mappings,\n                        result_fields,\n                        result_columns,\n                        result_rows,\n                    )\n                    _from += size\n                    if _from >= limit:\n                        break\n            else:\n                # TODO: Handle complete ElasticSearch queries (JSON based sent over HTTP POST)\n                raise Exception(\"Advanced queries are not supported\")\n\n            data = {\"columns\": result_columns, \"rows\": result_rows}\n        except requests.HTTPError as e:\n            logger.exception(e)\n            r = e.response\n            error = \"Failed to execute query. Return Code: {0}   Reason: {1}\".format(r.status_code, r.text)\n            data = None\n        except requests.exceptions.RequestException as e:\n            logger.exception(e)\n            error = \"Connection refused\"\n            data = None\n\n        return data, error\n\n\nclass ElasticSearch(BaseElasticSearch):\n    @classmethod\n    def enabled(cls):","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/getredash/redash/blob/ca79fe988d81cdac9675b412f3dfcab107bc1fbc/redash/query_runner/elasticsearch.py#L391-L427","documentation":"The legacy Elasticsearch runner only supports Lucene-style query-string searches sent as HTTP GET. If the query does not match the simple format, execution falls into the else branch of the parsing logic and raises 'Advanced queries are not supported'. Full JSON DSL queries (HTTP POST bodies) were never implemented (see the TODO in the source).","triggerScenarios":"Running a query whose parsed structure is not a simple query-string search — e.g. pasting a full Elasticsearch JSON DSL body ({\"query\": {\"bool\": ...}}) or any query that the runner's naive parser cannot reduce to a query string plus pagination parameters.","commonSituations":"Users copying curl examples from the Elasticsearch docs into Redash, migrating from Kibana saved queries, expecting the DSL support that the newer elasticsearch2 runner has.","solutions":["Rewrite the query as a Lucene query-string (e.g. status:active AND age:>30) instead of JSON DSL","Switch the data source to the 'ElasticSearch (new)' / elasticsearch2 query runner, which supports JSON DSL via POST","If stuck on the legacy runner, wrap the search in an external API and use the JSON URL query runner"],"exampleFix":"// before\n{\"query\": {\"term\": {\"status\": \"active\"}}}\n// after\nstatus:active","handlingStrategy":"validation","validationCode":"import json\n\ndef is_simple_query(q: str) -> bool:\n    q = q.strip()\n    if not q:\n        return False\n    if q.startswith(\"{\") or q.startswith(\"[\"):\n        try:\n            json.loads(q)\n            return False  # JSON DSL not supported by legacy runner\n        except ValueError:\n            pass\n    return True","typeGuard":null,"tryCatchPattern":"try:\n    result, error = runner.run_query(query, user)\nexcept Exception as e:\n    if \"Advanced queries are not supported\" in str(e):\n        raise UserError(\"Rewrite as a Lucene query string or switch to the Elasticsearch2 data source\")","preventionTips":["Keep queries as Lucene query strings on the legacy runner","Use elasticsearch2 data source for JSON DSL queries","Validate query shape client-side before submitting"],"tags":["elasticsearch","query-syntax","unsupported-feature"],"backgroundTag":"unsupported-query-syntax","analyzedSha":"ca79fe988d81cdac9675b412f3dfcab107bc1fbc","analyzedAt":"2026-08-28T18:32:34.637Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}