2017-06-23 3 views

答えて

0

アナライザパラメータと@Field注釈を試してみてください。

@Document(indexName = "lang") 
public class Test { 

    @Id 
    @Field(type = FieldType.String, index = FieldIndex.no, store = false) 
    private String id; 

    @Field(type = FieldType.Nested) 
    private LanguageValue namecustom; 

} 

class LanguageValue { 

    @Field(type = FieldType.String, index = FieldIndex.analyzed, analyzer = "standard", searchAnalyzer = "standard") 
    private String en; 

    @Field(type = FieldType.String, index = FieldIndex.analyzed, analyzer = "de_std", searchAnalyzer = "de_std") 
    private String de; 
} 

これは、次のマッピングを提供します:

{ 
    "lang": { 
     "mappings": { 
      "test": { 
       "properties": { 
        "id": { 
         "type": "string", 
         "index": "not_analyzed" 
        }, 
        "namecustom": { 
         "type": "nested", 
         "properties": { 
          "de": { 
           "type": "string", 
           "analyzer": "de_std" 
          }, 
          "en": { 
           "type": "string", 
           "analyzer": "standard" 
          } 
         } 
        } 
       } 
      } 
     } 
    } 
} 
関連する問題