Im getting the following error

Elasticsearch.Net.UnexpectedElasticsearchClientException: Message: expected:'{', actual:'" "', at offset:390

I understand the reason why but I'm not sure if it's solvable.

Im trying to get data for UnitDto which looks like below. The problem is that the VisitAddress is another class but the field in my unit index that correlates to VisitAddress.Address1 is also called VisitAddress. So since VisitAddress is not a string in the UnitDto class I get an error.

    public class UnitDto
        public Guid UnitId { get; set; }
        public int ActorNumber { get; set; }
        public int CustomerNumber { get; set; }
        public string CustomerName { get; set; }
        public string UnitName { get; set; }
        public string DepartmentName { get; set; }
        public AddressDto VisitAddress { get; set; }      // this class
        public AddressDto DeliveryAddress { get; set; }
        public string InternalInfo { get; set; }
        public string PublicInfo { get; set; }
        public string PickupInfo { get; set; }
        public SimpleGroupDto Group { get; set; }
        public UserDto ContactUser { get; set; }
        public string OrganisationNumber { get; set; }
    public class AddressDto
        public string Name { get; set; }
        public string Address1 { get; set; }            // this value
        public string Address2 { get; set; }
        public string PostalCode { get; set; }
        public string City { get; set; }
        public string Country { get; set; }

I would need to get the value of VisitAddres to VisitAddress.Address1 instead of it trying to give it to VisitAddress. It would not be possible to rename any of the fields unfortunately. Is it possible to work around this in the search somehow?

           var unitResponse = await EsClient().SearchAsync<UnitDto>(s => s
                .Query(q => q
                    .Match( m => m
                        .Field(f => f.VisitAddress.Name)

No one wanna give this a chance? :pleading_face:

I've tried getting around it by changing the class name of VisitAddress so it doesn't clash but it feels like I'm getting further from actually solving the problem of getting the values in the right place

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.