taylorm taylorm -4 years ago 94
Ruby Question

For a project using Rails with Java backend, where to construct ElasticSearch query, front end or back end?

I am writing a project using Ruby on Rails with Java as backend. I noticed that ElasticSearch has an open-source Ruby client where it could construct JSON query, and it also has Java API.

In this case, should I use the Ruby client (creating query in the front end) or the Java API client (creating query in the back end)? What would be the pros and cons of each approach?

Answer Source

Java API has direct access to the database not Rails. Currently, all the query has to go through the Java API.

Do you still have doubt?

If your rails app is used as client, then let be it. And let your Java/backend handle the backend explicitly. Just pass the query params from your rails app and construct, execute and return query results from your Java app.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download