I am using rest high level client elastic search in my JAVA application. Document can be found here. In my application at startup I am deleting index named "posts" where Elasticsearch datas are stored and creating again Index "posts" following this link
CreateIndexRequest request = new CreateIndexRequest("posts");
But, Inside index I need to create one type named "doc". Which is not mentioned in the website. Temporary fix is when I am posting some data following this link it is creating type
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put("user", "kimchy");
jsonMap.put("postDate", new Date());
jsonMap.put("message", "trying out Elasticsearch");
IndexRequest indexRequest = new IndexRequest("posts", "doc", "1")
.source(jsonMap);
But, in this process when I am posting only then I can able to create type "doc". If I am not posting and trying to hit controller which calls data frmo index "posts" and type "doc". It gives error as "doc" type is not there.
Anyone hava any idea how to create type using rest high level client ES in java