Spring elasticsearch - how to generate mapping for all the fields statically?

I have a Person class:

@Document(indexName = "person")
@EqualsAndHashCode(callSuper = true)
public class Person extends BaseEntity implements Serializable {

  private String firstName;

  private String lastName;

      mainField = @Field(type = FieldType.Keyword),
      otherFields = {
          @InnerField(type = FieldType.Text, suffix = "ngrams", analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
  private String fullName;

  private String maidenName;

I have an existing code that creates an index during startup:

final IndexOperations indexOperations = this.elasticsearchOperations.indexOps(clazz);

Now, I have a requirement to generate mappings from it and create mappings once. Can somebody help how can I integrate it with the existing code to include mappings of the fields to make them static?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.