當前位置: 首頁>>代碼示例>>C#>>正文


C# ElasticClient.RootNodeInfoAsync方法代碼示例

本文整理匯總了C#中Nest.ElasticClient.RootNodeInfoAsync方法的典型用法代碼示例。如果您正苦於以下問題:C# ElasticClient.RootNodeInfoAsync方法的具體用法?C# ElasticClient.RootNodeInfoAsync怎麽用?C# ElasticClient.RootNodeInfoAsync使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Nest.ElasticClient的用法示例。


在下文中一共展示了ElasticClient.RootNodeInfoAsync方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: StaticConnectionPool_DoesNotThrowOrRetry_On_401_Async

		public async void StaticConnectionPool_DoesNotThrowOrRetry_On_401_Async()
		{
			var nodes = new Uri[] {
				new Uri("http://invalid:[email protected]:9200"),
				new Uri("http://invalid:[email protected]:9201")
			};
			var pool = new StaticConnectionPool(nodes);
			var settings = new ConnectionSettings(pool)
				.MaximumRetries(3);
			var client = new ElasticClient(settings);
			var r = await client.RootNodeInfoAsync();
			r.IsValid.Should().BeFalse();
			r.ConnectionStatus.HttpStatusCode.Should().Be(401);
			r.ConnectionStatus.Metrics.Requests.Count.Should().Be(1);
			r.ConnectionStatus.Metrics.Requests[0].RequestType.Should().Be(RequestType.Ping);
			r.ConnectionStatus.NumberOfRetries.Should().Be(0);
		}
開發者ID:strongant,項目名稱:elasticsearch-net,代碼行數:17,代碼來源:UnauthorizedRequestTests.cs

示例2: StaticConnectionPool_ThrowsAndDoesNotRetry_On_401_Async

		public void StaticConnectionPool_ThrowsAndDoesNotRetry_On_401_Async()
		{
			var nodes = new Uri[] {
				new Uri("http://invalid:[email protected]:9200"),
				new Uri("http://invalid:[email protected]:9201")
			};
			var pool = new StaticConnectionPool(nodes);
			var settings = new ConnectionSettings(pool)
				.ThrowOnElasticsearchServerExceptions()
				.MaximumRetries(3);

			var client = new ElasticClient(settings);
			var e = Assert.Throws<ElasticsearchServerException>(async () => await client.RootNodeInfoAsync());
			e.Status.Should().Be(401);
		}
開發者ID:strongant,項目名稱:elasticsearch-net,代碼行數:15,代碼來源:UnauthorizedRequestTests.cs

示例3: Unauthorized_With_Ping_Disabled_Async

		public async void Unauthorized_With_Ping_Disabled_Async()
		{
			var nodes = new Uri[] {
				new Uri("http://invalid:[email protected]:9200"),
				new Uri("http://invalid:[email protected]:9201")
			};
			var pool = new StaticConnectionPool(nodes);
			var settings = new ConnectionSettings(pool)
				.MaximumRetries(3)
				.DisablePing();
			var client = new ElasticClient(settings);
			var r = await client.RootNodeInfoAsync();
			r.IsValid.Should().BeFalse();
			r.ConnectionStatus.HttpStatusCode.Should().Be(401);
			r.ConnectionStatus.Metrics.Requests.Count.Should().Be(1);
			r.ConnectionStatus.Metrics.Requests[0].RequestType.Should().Be(RequestType.ElasticsearchCall);
			r.ConnectionStatus.NumberOfRetries.Should().Be(0);
		}
開發者ID:strongant,項目名稱:elasticsearch-net,代碼行數:18,代碼來源:UnauthorizedRequestTests.cs

示例4: OnRequestCompletedIsCalled

 public void OnRequestCompletedIsCalled()
 {
     var counter = 0;
     var connectionPool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
     var settings = new ConnectionSettings(connectionPool, new InMemoryConnection())
         .OnRequestCompleted(r => counter++);
     var client = new ElasticClient(settings);
     client.RootNodeInfo();
     counter.Should().Be(1);
     client.RootNodeInfoAsync();
     counter.Should().Be(2);
 }
開發者ID:matteus6007,項目名稱:elasticsearch-net,代碼行數:12,代碼來源:Connecting.doc.cs


注:本文中的Nest.ElasticClient.RootNodeInfoAsync方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。