import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
 
@Document(indexName = "bankaccount")
public class BankAccount {
    @Field(type = FieldType.Keyword)
    private String accountNumber;
 
    @Field(type = FieldType.Text, fielddata = true)
    private String customerName;
 
    @Field(type = FieldType.Object)
    private Address address;
 
    // 假设Address是一个已经定义的类
    public static class Address {
        @Field(type = FieldType.Keyword)
        private String street;
 
        @Field(type = FieldType.Keyword)
        private String city;
 
        // getters and setters
    }
 
    // 其他字段、构造函数、getter和setter
}这个代码示例展示了如何在Spring Boot项目中使用Elasticsearch的@Document和@Field注解来映射一个复杂对象,如银行账户,其中包含地址信息。注意,实际使用时需要定义Address类以及其他必要的构造函数、getter和setter方法。