本文介绍了在ElasticSearch API应用程序中找不到NodeBuilder的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试实现Elasticsearch API.我在接受nodeBuilder的系统中出现错误.这是代码-
I am trying to implement the Elasticsearch API. I have errors with the system accepting nodeBuilder. Here is the code -
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>
客户端被识别.有什么想法吗?
Client is recognised. Any ideas?
推荐答案
NodeBuilder已被删除.虽然不正式支持在应用程序内直接使用Node,但仍可以使用Node(Settings)构造函数来构造它.请参考 https://www.elastic.co/guide/zh/elasticsearch/reference/5.5/breaking_50_java_api_changes.html
NodeBuilder has been removed. While using Node directly within an application is not officially supported, it can still be constructed with the Node(Settings) constructor.Refer- https://www.elastic.co/guide/en/elasticsearch/reference/5.5/breaking_50_java_api_changes.html
这篇关于在ElasticSearch API应用程序中找不到NodeBuilder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!