V
V
V2014-10-27 20:28:38
Ruby on Rails
V, 2014-10-27 20:28:38

How to implement multiple search fields with Elasticsearch and Rails?

I have a University model with several attributes: name, city, cost and so on. I wanted to make a search with many fields, that is, on the main page there is a search form and fields: name, city, cost, and so on. After looking at railscasts ( railscasts.com/episodes/306-elasticsearch-part-1?v... at the end I got one field.
That is, I need the user to drive into the fields "Moscow", "MGU", 300,000 and based on these parameters, he was given a valid result.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai, 2014-10-28
@ermolushka

You need to form a different filter or query than the one in Article::search. Read about them in the documentation for the Retire gem, and you can also have it at the elastic itself.
If you want to seriously get into the topic of indexing, I advise you to be skeptical about the gem. And especially to the inclusion of its modules in the model. You can work with elastic directly, bypassing all these abstractions of varying degrees of perforation, which, moreover, are covered by the elastic API late and not completely.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question