我要索引的文档具有名称为type
的属性。例如,当我使用轮胎存储轮胎时:
Tire.index 'mydocuments' do
delete
create
store :name => name, :type => 'pdf'
refresh
end
然后此文档是
_type = pdf
的索引,因此我可以使用http://localhost:9200/mydocuments/pdf/id
进行访问。但是,我该如何更改呢?类型是
mydocument
(单数),而不是从我来自文档源的实际type
属性复制而来。
最佳答案
您可以为您的对象实现document_type
方法,也可以为Hash使用_type
属性。见https://github.com/karmi/tire/blob/master/lib/tire/index.rb#L456-L459
关于ruby - 设置属性类型而不在带有Tire的ElasticSearch中设置_type,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16120427/