【发布时间】:2015-07-09 06:54:26
【问题描述】:
如何在索引上设置“ttl”“生存时间”(因此所有早于“60s”的结果都将从搜索中删除,例如在 play2-elasticsearch (https://github.com/cleverage/play2-elasticsearch) 中。
在经典的弹性搜索中,可以使用https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-ttl-field.html 完成
play2-elasticsearch 有设置选项,我尝试使用此更改
## 创建索引时应用的自定义设置(可选) elasticsearch.index.settings="{'_ttl' : { 'enabled' : true, 'default' : '60s' }"但即使过了一小时,结果仍然可以搜索。
我的搜索结果实体是这样注释的:
@IndexType(name = "searchResult") 公共类 SearchResult 扩展索引 { ...【问题讨论】:
标签: elasticsearch playframework ttl