What I am trying to achieve:
@timestamp
(note the "at" @ sign for timestamp, it is @timestamp
, not just timestamp).What I tried:
@Repository
public interface ElasticRepository extends ReactiveCrudRepository<ElasticPojo, String> {
}
@Document(indexName = "theindex")
public class ElasticPojo {
@Field(type = FieldType.Date)
private long timestamp;
@Id
private String id;
Issue:
This will insert a timestamp
field inside ElasticSearch, not @timestamp
How to insert a field @timestamp
?
Check the documentation for the @Field
annotation, it has a name
parameter:
@Field(name = "@timestamp", type = FieldType.Date)