per*_*kss 5 java clojure elasticsearch elasticsearch-jest
在 Clojure 中,我想互操作使用:
JestClientFactory factory = new JestClientFactory();
factory.setHttpClientConfig(new HttpClientConfig
.Builder("http://localhost:9200")
.build());
Run Code Online (Sandbox Code Playgroud)
所以我写了一些这样的代码:
(:import (io.searchbox.client JestClientFactory)
(io.searchbox.client.config HttpClientConfig$Builder))
(let [factory (JestClientFactory.)
http-client-config (-> (HttpClientConfig$Builder "http://localhost:9200")
(.build))])
Run Code Online (Sandbox Code Playgroud)
但是在构建 jar 时出现以下错误
期望 var,但 HttpClientConfig$Builder 映射到类 io.searchbox.client.config.HttpClientConfig$Builder
任何帮助都会很棒。
你缺的是.背后HttpClientConfig$Builder。您的代码基本上对类进行静态调用。你需要new你的例子中的。
(-> (HttpClientConfig$Builder. "http://localhost:9200") ; note the `.`
(.build))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
283 次 |
| 最近记录: |