I want to bring some data from elasticsearch, I succeeded with Spring Data Elasticsearch v 3.2.12, but with 4.x version I can't do same thing.
In elasticsearch, I have data like this:
{
"_index" : "abc",
"_type" : "_doc",
"_id" : "SVJhjnEB6V1CiOscApfa",
"_score" : 2.0954367E-5,
"_source" : {
"name" : "abc",
"timestamp" : "2020-04-18T20:40:51Z",
"temperature[*C]" : 20.56,
"humidity[%]" : 45.65
}
I want to use "_id" like id
My Dto class
@Data //from Lombok
@Document(indexName = "abc",type = "_doc")
public class Ascr2Dto {
@Id
@ReadOnlyProperty
private String id;
private String name;
private Date timestamp;
@JsonProperty("temperature[*C]")
private float temperature;
@JsonProperty("humidity[%]")
private float humidity;}
If I try to migrate from Spring Data Elasticsearch 3.x to 4.x, when I try findById method, I'm getting "IllegalArgumentException: null"
I went through this thread, without results Spring Data Elasticsearch (4.x) - Using @Id forces id field in _source
Thanks!