当前位置: 首页 > elasticsearch, 搜索 > 正文

翻译 elasticsearch _ttl

关键字:
1 星2 星3 星4 星5 星 (1 次投票, 评分: 5.00, 总分: 5)
Loading ... Loading ...
baidu_share

原文地址:http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-ttl-field.html

A lot of documents naturally come with an expiration date. Documents can therefore have a _ttl (time to live), which will cause the expired documents to be deleted automatically.

很多文档自然会有截止日期。因此,文档可以有一个_ttl(生存时间),这将导致过期的文档被自动删除。

enabled启用
By default it is disabled, in order to enable it, the following mapping should be defined:

默认情况下,它是禁用的。为了启用它,下面映射应该这样定义:

{
    "tweet" : {
        "_ttl" : { "enabled" : true }
    }
}

store/index 存储/索引
By default the _ttl field has store set to yes and index set to not_analyzed. Note that index property has to be set to not_analyzed in order for the purge process to work.

默认情况,_ttl字段已经存储,索引,设置为不用分词(not_analyzed).注意,索引属性设置为not_analyzed,为了清除过程工作。

default默认
You can provide a per index/type default _ttl value as follows:

你可以提供每一个索引/类型的默认_ttl值如下:

{
    "tweet" : {
        "_ttl" : { "enabled" : true, "default" : "1d" }
    }
}

In this case, if you don’t provide a _ttl value in your query or in the _source all tweets will have a _ttl of one day.

在这种情况下,如果你不能提供一个_ttl值在你的查询请求中,或者在_source中所有tweets将有一个一天的_ttl.

In case you do not specify a time unit like d (days), m (minutes), h (hours), ms (milliseconds) or w (weeks), milliseconds is used as default unit.
在这种情况下,你没有确定一个时间单元,像天,分钟,小时,毫秒 或者周,毫秒是被作为默认单元。

If no default is set and no _ttl value is given then the document has an infinite _ttl and will not expire.
如果没有默认被设置和没有_ttl值给这个文档,这个文档将会有一个无限的_ttl和将不会过期。

You can dynamically update the default value using the put mapping API. It won’t change the _ttl of already indexed documents but will be used for future documents.

你可以动态更新默认值在使用映射API的时候。它将不会改变已经存在索引文档的_ttl,但是将被会被用在将来的文档。

note on documents expiration注意文档过期

Expired documents will be automatically deleted regularly. You can dynamically set the indices.ttl.interval to fit your needs. The default value is 60s.

经常会被自动删除过期文件。你可以动态设置indices.ttl.interval 去适合你的需要。默认值是60s。

Note that the expiration procedure handle versioning properly so if a document is updated between the collection of documents to expire and the delete order, the document won’t be deleted.

注意,到期程序句柄的版本正确,因此,如果一个被更新文件在文档收集和和删除顺序之间,该文件不会被删除。

本文固定链接: http://www.chepoo.com/translate-elasticsearch-_ttl.html | IT技术精华网

翻译 elasticsearch _ttl:等您坐沙发呢!

发表评论