【问题标题】:IP - Inferred .NET type mapping elasticsearchIP - 推断的 .NET 类型映射 elasticsearch
【发布时间】:2021-06-07 15:42:29
【问题描述】:

我已阅读此文档inferred .net type mapping 并注意到有一个“ip_range”但没有“ip”。我创建了一个当前数据类型为 String 的模型类。我可以使用 C# 中的特定 IP 数据类型吗?还是应该将其保留为数据类型的字符串?

在 C# 中,public String Ip { get; set; }

【问题讨论】:

  • String 在大多数情况下都很好,但在 System.Net 命名空间中有一个内置的 IPAddress 类型。不知道你是否可以隐式地将它与弹性搜索一起使用......
  • 感谢您的帮助!

标签: c# elasticsearch nest


【解决方案1】:

没有隐式或推断映射到ip 数据类型的类型。选项是

  1. 使用fluent mapping.Ip(...) 方法显式映射
  2. 使用attribute mappingIpAttribute 显式映射
  3. 使用the visitor pattern 显式映射
  4. dynamically map using dynamic templates,可能通过匹配类型和名称模式

【讨论】:

  • 很高兴知道,感谢您提供的选项列表!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-02-26
  • 1970-01-01
  • 2021-05-27
  • 2019-10-18
  • 2014-03-10
相关资源
最近更新 更多