Skip to content

Property type and name attribute #8305

Closed
@YJTSec

Description

@YJTSec

Hi,
I have an index in the Elasticsearch with these fields:
id, title, price, create_time, object_color

I want to get these documents using v8 .net client so created this class:

class Document {
 public string Id {get ; set; }
 public string Title {get; set; }
 public double Price {get; set;}
 public DateTime CreateTime {get ;  set; }
 public string Color {get ;set ; }
}

When I search, the returned documents are not filled completely and the issue occurs in snake_case fields in the index. for example the returned document has Id, Title and Price values but CreateTime is not filled correctly and also Color is not filled because of different naming with the original field in the index.
the previous v7 NEST client had some attributes to handle this issue like ProperyName . I didn't find something similar in the new client. Is there any solution for this issue currently? Or any method to handle class properties mapping to the original index fields?

It will be nice if some attributes exist to handle class properties easier. just like previous client:
for example

class MyClass {
   [Attribute (type, relatedFiledName)]
   Property
}

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions