forked from github/dataease
fix: 识别 es 版本
This commit is contained in:
parent
1046e09c98
commit
f11b1e2dbb
@ -227,17 +227,15 @@ public class EsProvider extends DatasourceProvider {
|
|||||||
throw new Exception(JSONObject.parseObject(response).getJSONObject("error").getString("reason"));
|
throw new Exception(JSONObject.parseObject(response).getJSONObject("error").getString("reason"));
|
||||||
}
|
}
|
||||||
String version = JSONObject.parseObject(response).getJSONObject("version").getString("number");
|
String version = JSONObject.parseObject(response).getJSONObject("version").getString("number");
|
||||||
|
String[] versionList = version.split("\\.");
|
||||||
|
if(Integer.valueOf(versionList[0]) < 7 && Integer.valueOf(versionList[1]) < 3){
|
||||||
|
throw new Exception(Translator.get("i18n_es_limit"));
|
||||||
|
}
|
||||||
|
|
||||||
if(Integer.valueOf(version.split("\\.")[0]) < 6 ){
|
if(Integer.valueOf(versionList[0]) == 6 ) {
|
||||||
throw new Exception(Translator.get("i18n_es_limit"));
|
|
||||||
}
|
|
||||||
if(Integer.valueOf(version.split("\\.")[1]) < 3 ){
|
|
||||||
throw new Exception(Translator.get("i18n_es_limit"));
|
|
||||||
}
|
|
||||||
if(Integer.valueOf(version.split("\\.")[0]) == 6 ) {
|
|
||||||
esConfiguration.setUri("_xpack/sql");
|
esConfiguration.setUri("_xpack/sql");
|
||||||
}
|
}
|
||||||
if(Integer.valueOf(version.split("\\.")[0]) == 7 ) {
|
if(Integer.valueOf(versionList[0]) == 7 ) {
|
||||||
esConfiguration.setUri("_sql");
|
esConfiguration.setUri("_sql");
|
||||||
}
|
}
|
||||||
datasourceRequest.getDatasource().setConfiguration(new Gson().toJson(esConfiguration));
|
datasourceRequest.getDatasource().setConfiguration(new Gson().toJson(esConfiguration));
|
||||||
|
Loading…
Reference in New Issue
Block a user