Thursday, October 1, 2015

Make a field as `not_analyzed` index in Elasticsearch

To make a field as `not_analyzed` index in Elasticsearch,

use `@Field` as follows:

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

and check as follows:

curl -XGET 'http://localhost:9200/event/_mapping?pretty'

and then you will see as follows:

          "name" : {
            "type" : "string",
            "index" : "not_analyzed"
          },

Note that the following annotation doesn't work:

  @Field(index = FieldIndex.not_analyzed)

I'm not sure why type inference doesn't work.

No comments:

Post a Comment