我正在使用带有弹性搜索的Spring。我有两个对象:
@Document(indexName = "user")
public class user {
// unique id of client
@Id
private Long id;
//The email of the user
private String email;
@Field(type = FieldType.Nested, includeInParent = true)
private List<Company> companyList = new ArrayList<>();
}
和
public class Company {
private Long companyId;
//The name of the company
private String name;
private String city;
}
在没有用户ID的情况下,如何通过ID获得公司的名称?
谢谢