Skip to content

Instantly share code, notes, and snippets.

@revis0r
Created March 5, 2015 09:37
Show Gist options
  • Save revis0r/6b4a5a806da14f01f3b8 to your computer and use it in GitHub Desktop.
Save revis0r/6b4a5a806da14f01f3b8 to your computer and use it in GitHub Desktop.
move logs
new_version = 2
Tire.index "#{Settings::ElasticSearch.index}_v#{new_version}" do
delete
create :mappings => {
:Log => {
:properties => {
:id => { type: 'string', index: "not_analyzed", norms: { enabled: false }, include_in_all: false },
:object_id => { type: 'string', index: "not_analyzed", norms: { enabled: false }, include_in_all: false },
:company => { type: 'string', index: "not_analyzed", norms: { enabled: false }, include_in_all: false },
:domain => { type: 'string', index: "not_analyzed", norms: { enabled: false }, include_in_all: false },
:message => { type: 'string', analyzer: 'snowball' },
:controller => { type: 'string', index: "not_analyzed", norms: { enabled: false }, include_in_all: false },
:new_attributes_values => { type: 'object', index: "not_analyzed", norms: { enabled: false }, include_in_all: false },
:old_attributes_values => { type: 'object', index: "not_analyzed", norms: {enabled: false}, include_in_all: false },
:timestamp => { type: 'date', format: "date_time", index: "not_analyzed", norms:{ enabled: false }, include_in_all: false }
}
}
}
end
Tire.index "otp" do
reindex "#{Settings::ElasticSearch.index}_v#{new_version}"
end
Tire::Alias.create name: Settings::ElasticSearch.index, indices: ["#{Settings::ElasticSearch.index}_v#{new_version}"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment