Ricardo Rodriguez
Ricardo Rodriguez

Reputation: 1090

Nest ignoring complex properties when retrieving mappings

When mapping a DTO like this

public class InnerDto
{
    public string Uno { get; set;}
    public string Dos { get; set; }
}

public class OuterDto
{
    public string One { get; set; }
    public string Two {get; set; }
    public InnerDto Three {get; set; }
}

If I try to retrieve the mapping using elasticClient, for example:

Client.GetMapping<OuterDto>(s => s.Index("test2"));

The mapping returned by the client is missing my "Three" property (the one that is a "complex" type).

Looking to the ElasticSearch response, the data is returned. I´m missing any options in the GetMapping call?

Edit 1: The response of GET test2/_mapping

{
  "test2" : {
    "mappings" : {
      "outerdto" : {
        "properties" : {
          "one" : {
            "type" : "string"
          },
          "three" : {
            "properties" : {
              "dos" : {
                "type" : "string"
              },
              "uno" : {
                "type" : "string"
              }
            }
          },
          "two" : {
            "type" : "string"
          }
        }
      }
    }
  }
}

Upvotes: 1

Views: 147

Answers (1)

Greg Marzouka
Greg Marzouka

Reputation: 3325

Looks like this is a bug and has been fixed here. Thanks for finding and pointing this out.

Upvotes: 1

Related Questions