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


C# ElasticClient.RootNodeInfo方法代碼示例

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


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

示例1: ClientTestWhenThrowExceptionsDisabled

		public void ClientTestWhenThrowExceptionsDisabled()
		{
			var settings = new ConnectionSettings(new Uri("http://doesntexist:9200"));
			var client = new ElasticClient(settings);
			var response = client.RootNodeInfo();
			response.CallDetails.OriginalException.Should().NotBeNull();
			response.CallDetails.ServerError.Should().BeNull();
		}
開發者ID:hkjallbring,項目名稱:elasticsearch-net,代碼行數:8,代碼來源:ExceptionTests.cs

示例2: ClientTestWhenThrowExceptionsEnabled

		public void ClientTestWhenThrowExceptionsEnabled()
		{
			var settings = new ConnectionSettings(new Uri("http://doesntexist:9200"))
				.ThrowExceptions();
			var client = new ElasticClient(settings);
			var exception = Assert.Throws<ElasticsearchClientException>(() => client.RootNodeInfo());
			var inner = exception.InnerException;
			inner.Should().NotBeNull();
		}
開發者ID:hkjallbring,項目名稱:elasticsearch-net,代碼行數:9,代碼來源:ExceptionTests.cs

示例3: Connect

 protected void Connect(ElasticClient client, ConnectionSettings settings)
 {
     var result = client.RootNodeInfo();
     if (!result.IsValid)
     {
         Console.Error.WriteLine("Could not connect to {0}:\r\n{1}",
             settings.Host, result.ConnectionStatus.Error.OriginalException.Message);
         Console.Read();
     }
 }
開發者ID:rodrigopalhares,項目名稱:NEST,代碼行數:10,代碼來源:Tester.cs

示例4: Connect

 protected void Connect(ElasticClient client, ConnectionSettings settings)
 {
     var result = client.RootNodeInfo();
     if (!result.IsValid)
     {
         Console.Error.WriteLine("Could not connect to {0}:\r\n{1}",
             result.ConnectionStatus.RequestUrl, result.ConnectionStatus);
         Console.Read();
     }
 }
開發者ID:NickCraver,項目名稱:NEST,代碼行數:10,代碼來源:Tester.cs

示例5: connect_to_unknown_hostname

        public void connect_to_unknown_hostname()
        {
            IRootInfoResponse result = null;

            Assert.DoesNotThrow(() =>
            {
                var settings = new ConnectionSettings(new Uri("http://youdontownthis.domain.do.you"), "index");
                var client = new ElasticClient(settings);
                result = client.RootNodeInfo();
            });
            Assert.False(result.IsValid);
            Assert.NotNull(result.ConnectionStatus);
        }
開發者ID:rodrigopalhares,項目名稱:NEST,代碼行數:13,代碼來源:ConnectionTests.cs

示例6: ClientTestWhenThrowExceptionsDisabled

		public void ClientTestWhenThrowExceptionsDisabled()
		{
			var settings = new ConnectionSettings(new Uri("http://doesntexist:9200"));
			var client = new ElasticClient(settings);
			var response = client.RootNodeInfo();
#if DOTNETCORE
			// HttpClient does not throw on "known error" status codes (i.e. 404) thus OriginalException should not be set
			response.CallDetails.OriginalException.Should().BeNull();
#else
			response.CallDetails.OriginalException.Should().NotBeNull();
#endif
			response.CallDetails.ServerError.Should().BeNull();
		}
開發者ID:jeroenheijmans,項目名稱:elasticsearch-net,代碼行數:13,代碼來源:ExceptionTests.cs

示例7: ClientTestWhenThrowExceptionsEnabled

		public void ClientTestWhenThrowExceptionsEnabled()
		{
			var settings = new ConnectionSettings(new Uri("http://doesntexist:9200"))
				.ThrowExceptions();
			var client = new ElasticClient(settings);
			var exception = Assert.Throws<ElasticsearchClientException>(() => client.RootNodeInfo());
			var inner = exception.InnerException;
#if DOTNETCORE
			// HttpClient does not throw on "known error" status codes (i.e. 404) thus OriginalException should not be set
			inner.Should().BeNull();
#else
			inner.Should().NotBeNull();
#endif
		}
開發者ID:jeroenheijmans,項目名稱:elasticsearch-net,代碼行數:14,代碼來源:ExceptionTests.cs

示例8: StaticConnectionPool_ThrowsAndDoesNotRetry_On_401

		public void StaticConnectionPool_ThrowsAndDoesNotRetry_On_401()
		{
			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>(() => client.RootNodeInfo());
			e.Status.Should().Be(401);
		}
開發者ID:strongant,項目名稱:elasticsearch-net,代碼行數:15,代碼來源:UnauthorizedRequestTests.cs

示例9: connect_to_unknown_hostname

        public void connect_to_unknown_hostname()
        {
            IRootInfoResponse result = null;

            //this test will fail if fiddler is enabled since the proxy
            //will report a statuscode of 502 instead of -1
            Assert.Throws<MaxRetryException>(() =>
            {
                var settings = new ConnectionSettings(new Uri("http://youdontownthis.domain.do.you"), "index");
                var client = new ElasticClient(settings);
                result = client.RootNodeInfo();
                Assert.False(result.IsValid);
                Assert.NotNull(result.ConnectionStatus);
            });
        }
開發者ID:NickCraver,項目名稱:NEST,代碼行數:15,代碼來源:ConnectionTests.cs

示例10: connect_to_unknown_hostname

        public void connect_to_unknown_hostname()
        {
            Assert.DoesNotThrow(() =>
            {
                var settings = new ConnectionSettings(new Uri("http://youdontownthis.domain.do.you"));
                var client = new ElasticClient(settings);
                var result = client.RootNodeInfo();

                Assert.False(result.IsValid);
                Assert.NotNull(result.ConnectionStatus);

                Assert.True(result.ConnectionStatus.Error.HttpStatusCode == System.Net.HttpStatusCode.BadGateway
                    || result.ConnectionStatus.Error.ExceptionMessage.StartsWith("The remote name could not be resolved"));
            });
        }
開發者ID:nickcanz,項目名稱:NEST,代碼行數:15,代碼來源:ConnectionTests.cs

示例11: StaticConnectionPool_DoesNotThrowOrRetry_On_401

		public void StaticConnectionPool_DoesNotThrowOrRetry_On_401()
		{
			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 = client.RootNodeInfo();
			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

示例12: Unauthorized_With_Ping_Disabled

		public void Unauthorized_With_Ping_Disabled()
		{
			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 = client.RootNodeInfo();
			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

示例13: TestConnectSuccessWithUri

        public void TestConnectSuccessWithUri()
        {
            var settings = new ConnectionSettings(Test.Default.Uri, "index");
            var client = new ElasticClient(settings);
            var result = client.RootNodeInfo();

            Assert.True(result.IsValid);
            Assert.NotNull(result.ConnectionStatus.HttpStatusCode);
        }
開發者ID:NickCraver,項目名稱:NEST,代碼行數:9,代碼來源:ConnectionTests.cs

示例14: ModifyJsonSerializerSettingsIsCalled

		public void ModifyJsonSerializerSettingsIsCalled()
		{
			var connectionPool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
			var settings = new ConnectionSettings(connectionPool, new InMemoryConnection(), s => new MyJsonNetSerializer(s));
			var client = new ElasticClient(settings);
			client.RootNodeInfo();
			client.RootNodeInfo();
			var serializer = ((IConnectionSettingsValues)settings).Serializer as MyJsonNetSerializer;
			serializer.X.Should().BeGreaterThan(0);
		}
開發者ID:matteus6007,項目名稱:elasticsearch-net,代碼行數:10,代碼來源:Connecting.doc.cs

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