【问题标题】:How to provide elasticsearch TTL per index document operation?如何为每个索引文档操作提供 elasticsearch TTL?
【发布时间】:2014-01-25 07:27:17
【问题描述】:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-ttl-field.html 似乎表明可以为每个查询设置一个 TTL(我假设这意味着它可以在每个索引操作的基础上设置)。这是怎么做到的?

这只是做类似的事情:

client.prepareIndex('index-name', 'type-name')
        .setSource(jsonBuilder()
                    .startObject()
                        .field('_ttl', '1d')
                        .field('other-field', 'other-value')
                    .endObject()
                  )
        .execute()
        .actionGet();

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    【讨论】:

    • 您需要在映射中启用_ttl 字段,因为它默认是禁用的。
    猜你喜欢
    • 2021-11-16
    • 2019-10-27
    • 1970-01-01
    • 2016-08-03
    • 1970-01-01
    • 2021-07-19
    • 2014-05-05
    • 2020-06-25
    • 1970-01-01
    相关资源
    最近更新 更多