【发布时间】:2017-01-03 18:45:38
【问题描述】:
我使用 Tire gem 在 Elasticsearch 中索引了一些 PDF 附件。这一切都很好,但我将拥有许多 GB 的 PDF,我们可能会将 PDF 存储在 S3 中以供访问。目前 base64 编码的 PDF 存储在 Elasticsearch _source 中,这将使索引变得巨大。我想让附件被索引,但不存储,我还没有找到正确的咒语来放入轮胎的“映射”块以防止它。块现在是这样的:
mapping do
indexes :id, :type => 'integer'
indexes :title
indexes :last_update, :type => 'date'
indexes :attachment, :type => 'attachment'
end
我尝试了一些变体,例如:
indexes :attachment, :type => 'attachment', :_source => { :enabled => false }
当我运行轮胎:import rake 任务时它看起来不错,但它似乎没有任何区别。有谁知道A)如果这是可能的? B) 怎么做?
提前致谢。
【问题讨论】:
-
您要完全禁用源还是只排除该特定字段?
-
最好只排除这个字段,以便突出显示/等在其他字段上仍然可用。我想我可以存储我们想要突出显示和完全禁用源的特定字段,但我还不清楚这会产生什么整体效果。
标签: elasticsearch attachment tire