Skip to content

DataMember Name is ignored when retrieving documents #3900

@andrewrimmer

Description

@andrewrimmer

NEST/Elasticsearch.Net version:7.0

Elasticsearch version:7.2

Description of the problem including expected versus actual behavior:

When performing a search the list of documents returned is missing any of the field values when the json field name is different to the c# class member name.

For example, if you have a type with the following property, it is not being returned.

    [DataMember(Name = "city_name")]
    public string CityName { get; set; }

This worked fine in 6.x, and I guess it is as a result of the internal serializer having changed.

All of the c# types that we use with Elasticsearch are kept in an assembly with no dependency on NEST (i.e. they are essentially plain DTOs). If we are to perform a workaround, we would prefer a solution where our DTO classes do not take a dependency on NEST (if that is now possible).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions