With ElasticSearchTemplate I can easily create index out of a simple entity class. Say I want to save the Book.java:
@Document(indexName = "bookshop", type = "book", shards = 2, replicas = 2, refreshInterval = "-1")
public class Book {
@Id
private String id;
@Field(type = FieldType.String, store = true)
private String title;
}
Its enough just to make:
elasticsearchTemplate.createIndex(Book.class);
elasticsearchTemplate.putMapping(Book.class);
elasticsearchTemplate.refresh(Book.class);
Can this be achieved with pure ES Java API without the spring-data-elasticsearch and operations on Strings(JSON)?