当前位置: 首页>>代码示例>>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;未经允许,请勿转载。