Supporting file upload & indexing in Rails app with elasticsearch/tire


(Meltemi) #1

I'm trying to build a Rails app that allows users to upload (carrierwave)
reports (PDFs) that are will be automatically indexed (elasticsearch/tire).
I'm not finding any examples of such a workflow so wondering if maybe I've
chosen the wrong tools/gems?

We can successfully index PDFs manually (json-rest api) but are struggling
with how to set up an ActiveModel object and attachment mappings with Tire.

The Report model would have, among other attributes, a string which is the
pathname to the PDF in the filesystem. How then to have elasticsearch index
the file in that pathname and also index any other attributes associated
with said Report object?

Any help, a mock-model, or link to some examples of using Tire with
attachments (PDFs) would be really helpful. As I've said earlier we can
index PDFs with elasticsearch alone just not sure how to roll this into a
Rails app.


(system) #2