Search code examples
c#elasticsearchnest

IP - Inferred .NET type mapping elasticsearch


I have read this document inferred .net type mapping and noticed that there is a "ip_range" but there is not "ip". I created a model class that is currently of datatype String. Is there a specific IP datatype in C# I can use? Or should I leave it as String for the datatype?

enter image description here

In C# I have, public String Ip { get; set; }


Solution

  • There is no type that implicitly or infer maps to the ip data type. The options are

    1. explicitly map using fluent mapping and the .Ip(...) method
    2. explicitly map using attribute mapping and the IpAttribute
    3. explicitly map using the visitor pattern
    4. dynamically map using dynamic templates, perhaps by matching type and name pattern