Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to config not_analyzed with @Field annotation in spring-data-elasticsearch 3.0.0.RC2

In spring-data-elasticsearch 3.0.0.RC2, @Field annotation has a boolean index() and a String analyzer(). How to config "not_analyzed" with @Field annotation?

like image 970
cbb Avatar asked Jul 31 '17 02:07

cbb


1 Answers

With previous versions of Spring Data ES that worked with ES 2.x, you used to do it this way:

@Field(type=FieldType.String, index=FieldIndex.not_analyzed)
String myField;

With Spring Data ES 3.0.0 (which works with ES 5.x), you now do it like this:

@Field(type=FieldType.Keyword)
String myField;
like image 65
Val Avatar answered Sep 21 '22 15:09

Val