java – 在ElasticSearch API应用程序中找不到NodeBuilder
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了java – 在ElasticSearch API应用程序中找不到NodeBuilder,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1625字,纯文字阅读大概需要3分钟。
内容图文
![java – 在ElasticSearch API应用程序中找不到NodeBuilder](/upload/InfoBanner/zyjiaocheng/773/17f6efa94e5443429c6af8d7fc3b8caa.jpg)
我正在尝试实现Elasticsearch API.我在系统接受nodeBuilder时遇到错误.这是代码 –
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.client.Client;
//import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.*;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.node.NodeBuilder.*;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
// on startup
Node node = nodeBuilder().node(); // nodeBuilder not recognised.
Client client = node.client();
// on shutdown
node.close();
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>2.2.0</version>
</dependency>
客户得到认可.有任何想法吗?
解决方法:
在ES API 5中删除了ClientBuilder.
您可以使用org.elasticsearch.common.settings.Settings.builder(),它将为您提供Builder的实例.
Exp:
Settings.Builder elasticsearchSettings =
Settings.builder()
.put("http.enabled", "true")
.put("index.number_of_shards", "1")
.put("path.data", new File(tmpDir, "data").getAbsolutePath())
.put("path.logs", new File(tmpDir, "logs").getAbsolutePath())
.put("path.work", new File(tmpDir, "work").getAbsolutePath())
.put("path.home", tmpDir);
内容总结
以上是互联网集市为您收集整理的java – 在ElasticSearch API应用程序中找不到NodeBuilder全部内容,希望文章能够帮你解决java – 在ElasticSearch API应用程序中找不到NodeBuilder所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。