tire

ElasticSearch & Tire: Using Mapping and to_indexed_json

南笙酒味 提交于 2019-11-27 01:49:28
问题 While reading the Tire doc, I was under the impression that you should use either mapping or to_indexed_json methods, since (my understanding was..) the mapping is used to feed the to_indexed_json . The problem is, that I found some tutorials where both are used. WHY? Basically, my app works right now with the to_indexed_json but I can't figure out how to set the boost value of some of the attributes (hence the reason I started looking at mapping) and I was wondering if using both would

Index the results of a method in ElasticSearch (Tire + ActiveRecord)

微笑、不失礼 提交于 2019-11-27 01:40:01
问题 I'm indexing a data set for elasticsearch using Tire and ActiveRecord. I have an Artist model, which has_many :images. How can I index a method of the Artist model which returns a specific image? Or alternatively reference a method of the associated model? My desired Artist result will include the paths for the primary Image associated with the Artist (both the original and the thumbnail). I've tried this mapping: mapping do indexes :id, :index => :not_analyzed indexes :name indexes :url

Elasticsearch, Tire, and Nested queries / associations with ActiveRecord

怎甘沉沦 提交于 2019-11-26 10:25:31
问题 I\'m using ElasticSearch with Tire to index and search some ActiveRecord models, and I\'ve been searching for the \"right\" way to index and search associations. I haven\'t found what seems like a best practice for this, so I wanted to ask if anyone has an approach that they think works really well. As an example setup (this is made up but illustrates the problem), let\'s say we have a book, with chapters. Each book has a title and author, and a bunch of chapters. Each chapter has text. We