我正在使用elasticsearch版本-6.1.1。我已经下载了方解石框架项目,并按照(https://calcite.apache.org/docs/tutorial.html)的教程在我的机器上构建它,当我尝试使用方法的Elasticsearch2adaptor连接到elasticsearch时如此处所示(https://calcite.apache.org/docs/elasticsearch_adapter.html).i'得到以下错误 错误:
*E:\calcite\elasticsearch2>sqlline
sqlline version 1.3.0
sqlline> !connect jdbc:calcite:model=target/test-classes/mymodel.json admin admin
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Connecting to jdbc:calcite:model=target/test-classes/mymodel.json
java.lang.RuntimeException: Error instantiating JsonCustomSchema(name=elasticsearch)
at org.apache.calcite.model.ModelHandler.visit(ModelHandler.java:275)
at org.apache.calcite.model.JsonCustomSchema.accept(JsonCustomSchema.java:45)
at org.apache.calcite.model.ModelHandler.visit(ModelHandler.java:196)
at org.apache.calcite.model.ModelHandler.<init>(ModelHandler.java:88)
at org.apache.calcite.jdbc.Driver$1.onConnectionInit(Driver.java:104)
at org.apache.calcite.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:139)
at sqlline.DatabaseConnection.connect(DatabaseConnection.java:156)
at sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:204)
at sqlline.Commands.connect(Commands.java:1095)
at sqlline.Commands.connect(Commands.java:1001)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:38)
at sqlline.SqlLine.dispatch(SqlLine.java:791)
at sqlline.SqlLine.begin(SqlLine.java:668)
at sqlline.SqlLine.start(SqlLine.java:373)
at sqlline.SqlLine.main(SqlLine.java:265)
Caused by: java.lang.RuntimeException: ***Cannot connect to any elasticsearch nodes***
at org.apache.calcite.adapter.elasticsearch2.Elasticsearch2Schema.open(Elasticsearch2Schema.java:123)
at org.apache.calcite.adapter.elasticsearch2.Elasticsearch2Schema.<init>(Elasticsearch2Schema.java:73)
at org.apache.calcite.adapter.elasticsearch2.Elasticsearch2SchemaFactory.create(Elasticsearch2SchemaFactory.java:56)
at org.apache.calcite.model.ModelHandler.visit(ModelHandler.java:270)
... 18 more*
这是mymodel.json文件:
{
"version":"1.0",
"defaultSchema":"elasticsearch",
"schemas": [
{
"type" : "custom",
"name" : "elasticsearch",
"factory" : "org.apache.calcite.adapter.elasticsearch2.Elasticsearch2SchemaFactory",
"operand" : {
"coordinates" : "{'127.0.0.1':9300}",
"userConfig" : "{'bulk.flush.max.actions':10 , 'bulk.flush.max.size.mb': 1}",
"index" : "movies"
}
}
]
}
答案 0 :(得分:0)
您提到的适配器与Elasticsearch 6.x不兼容
从适配器的网页引用
此适配器的目标是Elasticsearch 2.x.使用方解石 Elasticsearch 5.x +您可以使用目标适配器的工厂 Elasticsearch 5.x:
您可以将Elasticsearch降级到版本2.x或5.x,它应该可以正常工作