我使用它向弹性缓存索引中添加了一组记录:
def self.index_trends(trend_hashes)
formatted_trends = trend_hashes.map do |trend_hash|
{
index: {
_index: 'trends',
_type: 'trend',
_id: trend_hash["id"],
data: trend_hash
}
}
end
elasticsearch.bulk({
body: formatted_trends
})
end现在我需要更新一条记录(给出它的id)。我只想在data哈希中添加一个键-val,而不是替换整个状态。我如何使用elasticsearch-ruby来完成这个任务?
发布于 2017-02-17 00:47:52
https://stackoverflow.com/questions/42287327
复制相似问题