Skip to content

Commit

Permalink
fix: update the opendistro sql endpoint
Browse files Browse the repository at this point in the history
Reference preset-io#74
Adding format=jdbc to the path for the opendistro sql endpoint
  • Loading branch information
harshgadhia authored Nov 5, 2021
1 parent 470f67c commit f35ee09
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion es/opendistro/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,15 @@ class Cursor(BaseCursor):
}

def __init__(self, url: str, es: Elasticsearch, **kwargs: Any) -> None:
"""
By default the opendistro sql plugin returns original response from Elasticsearch in JSON.
Hence, adding format=jdbc to the path
https://github.com/preset-io/elasticsearch-dbapi/issues/74
https://opendistro.github.io/for-elasticsearch-docs/docs/sql/protocol/#jdbc-format
"""
super().__init__(url, es, **kwargs)
self.sql_path = kwargs.get("sql_path") or "_opendistro/_sql"
self.sql_path = kwargs.get("sql_path") or "_opendistro/_sql?format=jdbc"
# Opendistro SQL v2 flag
self.v2 = kwargs.get("v2", False)
if self.v2:
Expand Down

0 comments on commit f35ee09

Please sign in to comment.