Spring Data Elasticsearch MultiField 的 Mainfield 名称属性不起作用

Spring Data Elasticsearch MultiField's Mainfield name attribute not working

我有一个 spring 启动应用程序,带有 Spring Data Elasticsearch v4.0.1。如果我这样创建文档 class:

@Document(indexName = "paystub")
public class PayStubEntity {

  @MultiField(
      mainField = @Field(type = Text, name = "account_number"),
      otherFields = {@InnerField(suffix = "keyword", type = Keyword)})
  private String acctNumber;

  @Field(type = Keyword, name = "ccy")
  private String currency;

 ...

生成的映射是:

{
    "paystub": {
        "mappings": {
            "properties": {
                "acctNumber": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword"
                        }
                    }
                },
                "ccy": {
                    "type": "keyword"
                },
                ...
             }
        }
    }
}

很明显,索引和映射创建中使用了货币字段注释中的名称属性值,即“ccy”。但是,对于字段 acctNumber 上的 MultiField 注释中的 mainField 名称属性,情况似乎并非如此。

文档here说明Field注解的name属性将代表Elasticsearch文档的字段名称,如果不设置name属性则默认为被注解的名称场.

但是当在多字段注释中使用字段注释时,这似乎不起作用。

有解决办法吗?

感谢您的帮助!

这已在 this issue 中修复,并在版本 4.0.3 和 4.1.M2

中发布