@Field(index = FieldIndex.analyzed, type = FieldType.String)
How to add annotation here to disable norms for the analysed field
As there is no way to add norms enable-false attribute as part of @field annotations in java entity, we can add all mappings (all required types with attributes as mappings) in mappings.json file and refer this file in entity file. Like as below
@Document(indexName = "jobindex")
@Setting(settingPath = "/config/elasticsearch-settings.json")
@Mapping(mappingPath = "/config/mappings.json") //THIS ONE TO ADD
public class JobIndex implements Serializable {
}
and mappings.json look like
"mappings": {
"_doc": {
"properties": {
"title": {
"type": "text",
"norms": { "enabled": false }
}
}
}
}
NOTE: when you add specific attributes as part of mappings.json which are not available in java @Field annotations then better add all field annotations part of json file rather than in java@Field annotations. So the conclusion is java entity should be without field annotations and all mappings should be in mappings.json file and that file should be referred in entity header as mentioned in the first code block of this answer.