2013-04-30 46 views

回答

0

如果你不使用加載ActiveModel集成,使用@MarcusGranström答案

Tire.index 'index-with-ttl' do 
    delete 
    create mappings: { 
    document: { 
    _ttl:  { enabled: true , default: "1d" },  
    properties: { 
     # properties goes here 
    } 
    } 
} 
refresh 
end 

如果你使用ActiveModel集成

tire do 
    settings do 
     # Expiring the index after 30 days (_ttl parameter) 
     # http://www.elasticsearch.org/guide/reference/mapping/ttl-field/ 
     mapping _ttl: { enabled: true, default: '30d' } do 
     # add the indexes here 
     end 
    end  
    end 
1

不存在輪胎專家在所有,但認爲這將這樣的伎倆:

Tire.index 'index-with-ttl' do 
    delete 
    create mappings: { 
    document: { 
    _ttl:  { enabled: true , default: "1d" },  
    properties: { 
     # properties goes here 
    } 
    } 
} 
refresh 
end 
相關問題