当前位置: 首页>>代码示例>>C#>>正文


C# ElasticClient.GetMapping方法代码示例

本文整理汇总了C#中Nest.ElasticClient.GetMapping方法的典型用法代码示例。如果您正苦于以下问题:C# ElasticClient.GetMapping方法的具体用法?C# ElasticClient.GetMapping怎么用?C# ElasticClient.GetMapping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nest.ElasticClient的用法示例。


在下文中一共展示了ElasticClient.GetMapping方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ServerTestWhenThrowExceptionsDisabled

		//[I]
		public void ServerTestWhenThrowExceptionsDisabled()
		{
			var settings = new ConnectionSettings(new Uri("http://ipv4.fiddler:9200"));
			var client = new ElasticClient(settings);
			var response = client.GetMapping<Project>(s => s.Index("doesntexist"));
			response.CallDetails.OriginalException.Should().NotBeNull();
			response.CallDetails.ServerError.Should().NotBeNull();
			response.CallDetails.ServerError.Status.Should().BeGreaterThan(0);
		}
开发者ID:emohebi,项目名称:elasticsearch-net,代码行数:10,代码来源:ExceptionTests.cs

示例2: ServerTestWhenThrowExceptionsEnabled

		//[I]
		public void ServerTestWhenThrowExceptionsEnabled()
		{
			var settings = new ConnectionSettings(new Uri("http://ipv4.fiddler:9200"))
				.ThrowExceptions();
			var client = new ElasticClient(settings);
			var exception = Assert.Throws<ElasticsearchClientException>(() => client.GetMapping<Project>(s => s.Index("doesntexist")));
			exception.InnerException.Should().NotBeNull();
			exception.Response.Should().NotBeNull();
			exception.Response.ServerError.Should().NotBeNull();
			exception.Response.ServerError.Status.Should().BeGreaterThan(0);
		}
开发者ID:emohebi,项目名称:elasticsearch-net,代码行数:12,代码来源:ExceptionTests.cs

示例3: ServerTestWhenThrowExceptionsDisabled

		public void ServerTestWhenThrowExceptionsDisabled()
		{
			var settings = new ConnectionSettings(new Uri($"http://{TestClient.Host}:{_port}"));
			var client = new ElasticClient(settings);
			var response = client.GetMapping<Project>(s => s.Index("doesntexist"));
#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().NotBeNull();
			response.CallDetails.ServerError.Status.Should().BeGreaterThan(0);
		}
开发者ID:jeroenheijmans,项目名称:elasticsearch-net,代码行数:14,代码来源:ExceptionTests.cs

示例4: ServerTestWhenThrowExceptionsEnabled

		public void ServerTestWhenThrowExceptionsEnabled()
		{
			var settings = new ConnectionSettings(new Uri($"http://{TestClient.Host}:{_port}"))
				.ThrowExceptions();
			var client = new ElasticClient(settings);
			var exception = Assert.Throws<ElasticsearchClientException>(() => client.GetMapping<Project>(s => s.Index("doesntexist")));
#if DOTNETCORE 
			// HttpClient does not throw on "known error" status codes (i.e. 404) thus the inner exception should not be set
			exception.InnerException.Should().BeNull();
#else
			exception.InnerException.Should().NotBeNull();
#endif
			exception.Response.Should().NotBeNull();
			exception.Response.ServerError.Should().NotBeNull();
			exception.Response.ServerError.Status.Should().BeGreaterThan(0);
		}
开发者ID:jeroenheijmans,项目名称:elasticsearch-net,代码行数:16,代码来源:ExceptionTests.cs

示例5: CanDeserializeCopyTo

		public void CanDeserializeCopyTo()
		{
			var json = "{\"test-events-v1-201412\":{\"mappings\":{\"events\":{\"dynamic\":\"false\",\"_size\":{\"enabled\":true},\"properties\":{\"created_utc\":{\"type\":\"date\"},\"data\":{\"properties\":{\"@environment\":{\"properties\":{\"o_s_name\":{\"type\":\"text\",\"index\":false,\"copy_to\":[\"os\"]}}}}},\"id\":{\"type\":\"keyword\"},\"os\":{\"type\":\"text\",\"fields\":{\"keyword\":{\"type\":\"keyword\",\"ignore_above\":256}}}}}}},\"test-events-v1-201502\":{\"mappings\":{\"events\":{\"dynamic\":\"false\",\"_size\":{\"enabled\":true},\"properties\":{\"created_utc\":{\"type\":\"date\"},\"data\":{\"properties\":{\"@environment\":{\"properties\":{\"o_s_name\":{\"type\":\"text\",\"index\":false,\"copy_to\":[\"os\"]}}}}},\"id\":{\"type\":\"keyword\"},\"os\":{\"type\":\"text\",\"fields\":{\"keyword\":{\"type\":\"keyword\",\"ignore_above\":256}}}}}}}}";

			var pool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));

			var connection = new InMemoryConnection(Encoding.UTF8.GetBytes(json));
			var settings = new ConnectionSettings(pool, connection).DefaultIndex("test-events-v1-201412");
			var client = new ElasticClient(settings);

			var mappingResponse = client.GetMapping<Events>();

			mappingResponse.IsValid.Should().BeTrue();

			var mappingWalker = new MappingWalker(new CopyToVisitor());
			mappingWalker.Accept(mappingResponse);
		}
开发者ID:niemyjski,项目名称:elasticsearch-net,代码行数:17,代码来源:GithubIssue2409.cs


注:本文中的Nest.ElasticClient.GetMapping方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。