8

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?

cbb
  • 141
  • 1
  • 2
  • 5

1 Answers1

19

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;
Alexander Kjäll
  • 4,246
  • 3
  • 33
  • 57
Val
  • 207,596
  • 13
  • 358
  • 360
  • 1
    How to proceed if the attribute is @Field(type=FieldType.Object) and ES 7.x? – user1337 Oct 31 '19 at 10:16
  • 1
    @val so, we cannot control index type ? say index=not_analyzed as we could in ES – Lasit Pant Dec 21 '19 at 04:53
  • @LasitPant `index=not_analyzed` has been deprecated in ES5, so if you're using a recent release then it is not necessary anymore – Val Dec 21 '19 at 05:11