c# - 在elasticsearch中使用.net创建节点
问题描述
我有一个带有一个节点的 elasticsearch 数据库,并想再创建一个节点。我使用 Elasticsearch Head 查看节点和 Visualstudio C# 来创建索引和插入数据。
我一直在阅读弹性搜索页面:https ://www.elastic.co/guide/en/elasticsearch/client/net-api/6.x/keeping-track-of-nodes.html 但我似乎错过了一些东西创建节点。我试过这个
using Nest;
public ActionResult CreateNode(){
Elasticsearch.Net.Node node = new Elasticsearch.Net.Node(new
Uri("http://localhost:9200")){
MasterEligible = true,
HoldsData = true,
Name = "SecondNode" };
// node.Uri.Should().NotBeNull(); .Should doesn't work
// node.Uri.Port.Should().Be(9200);
return View("~/Views/Home/Index.cshtml");}