Field @timestamp使用Spring Data ElasticSearch

x33g5p2x  于 2023-04-05  发布在  ElasticSearch
关注(0)|答案(1)|浏览(158)

我想达到的目标:

  • 使用Reactive Spring Data ElasticSearch在ElasticSearch中插入文档,字段为@timestamp(注意timestamp的“at”@符号,它是@timestamp,而不仅仅是timestamp)。

我尝试了:

@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;

问题:
这将在ElasticSearch中插入timestamp字段,而不是@timestamp
如何插入字段@timestamp

gdx19jrr

gdx19jrr1#

查看@Field注解的文档,它有一个name参数:

@Field(name = "@timestamp", type = FieldType.Date)

相关问题