I'm using the .NET nuget package 'Elastic.Clients.Elasticsearch' (version 8) and trying to create an index mapping based on the below model. How do I map the Employee members and its JobRole members? I tried using "Object" and "Nested", without luck.
Furthermore how do I exclude properties from being indexed? Attribute mapping like:
[Text(Name = "last_name")]
... is no longer supported in version 8. The only option is "fluent mapping".
Unfortunately there's only documentation available for version 7, https://www.elastic.co/guide/en/elasticsearch/client/net-api/7.17/fluent-mapping.html
public class Company
{
public string CompanyName { get; set; }
public Employee EmployeeInfo { get; set; }
}
public class Employee
{
public string EmployeeName { get; set; }
public JobRole[] JobRoles { get; set; }
}
public class JobRole
{
public string RoleName { get; set; }
}
This is my code and as you can see I got lost halfway..
var createIndexResponse = client.Indices.Create<Company>("myindex", c => c
.Mappings(m => m
.Properties(p => p
.Keyword(s => s.CompanyName)
.Object<Employee> (x=>x.EmployeeInfo.EmployeeName // Got lost here...
)
)
);
Anyone?