Stack Exchange
spring-data-elasticsearch entity removing deprecated type
Elasticsearch will remove _type in version 8. I am developing a Spring boot microservice, using ElasticRepository, so I would like to set up the Entity in order not to use it. As far as I know, if you do not implicitly specify a type in @Document, it will take the class name in lower case.
How do I specify not to use a type instead type = "_doc"?
Elastic Search: 7.5.1
Spring boot: 2.2.1
package org.elastic.model;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;

@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
@SuppressWarnings("unused")

@Document(indexName = "basic_data",type = "_doc")
public class BasicData {

    @Id
    private String id;
    private String field1;
    private String field2;
}


have you checked if the updated java client for es8 won't solve this issue for you?

Spring Boot 2.2.1 and the corresponding Spring Data Elasticsearch 3.2.x use the Elasticsearch 6.8.5 libraries. You won't be able to use this versions with a Elasticsearch 7 cluster, the client libraries of 6.8 are not compatible to a server in version 7.
In the next version of Spring Data Elasticsearch which should be released this spring, the targeted Elasticsearch version is 7.5 (I will update this to 7.6 in the next days). There we have deprecated the code where the user puts the type information (for example in the @Documentannotation) and we don't use it anymore in the underlying calls to Elasticsearch. So for the time being you can leave it in the annotation for the next version to come.
Once Elasticsearch 8 is released our then next version of Spring Data Elasticsearch will use that and then we will probably remove this from our code as well to clean up.

My software uses Spring Data Elasticsearch 3.2.1, Elasticsearch 6.8.4 and reads from Elasticsearch 7.5.1. It seems to work properly in Certification environment. What problems can I find?

If you have no problems so far with using a .8.4 client agains a 7 cluster that's great. I can't tell exaclt what problems we ran into, but often these changes come when parsing special fields from results or stuff like that (I am talking about processes in the elasticsearch library). Sometimes they even have breaking changes in patchlevel versions.
