0

@Field(index = FieldIndex.analyzed, type = FieldType.String)

How to add annotation here to disable norms for the analysed field

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.