feat: support Elasticsearch datasource #108

This commit is contained in:
junjun
2025-09-16 14:53:27 +08:00
parent db0ab2c077
commit 69bc20698c
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -434,4 +434,4 @@ def exec_sql(ds: CoreDatasource | AssistantOutDsSchema, sql: str, origin_column=
return {"fields": columns, "data": result_list,
"sql": bytes.decode(base64.b64encode(bytes(sql, 'utf-8')))}
except Exception as ex:
raise ParseSQLResultError(str(ex))
raise Exception(str(ex))
+1 -1
View File
@@ -63,7 +63,7 @@ def get_es_fields(conf: DatasourceConf, table_name: str):
def get_es_data(conf: DatasourceConf, sql: str, table_name: str):
r = requests.post(f"{conf.host}/_sql/translate", json={"query": sql})
if r.json().get('error'):
raise BaseException(f'{json.dumps(r.json())}')
print(json.dumps(r.json()))
es_client = get_es_connect(conf)
response = es_client.search(