Elasticsearch rails gem -
I would like to ask, if there is a gem then you would advise me to use my rail app to add SearchCheck or Chevy Such elastic search would be great if there were some simple tutorials about how to use it. Thank you.
It depends on which rail / elastic search combination you are using:
Elasticsearch version> = 1
elasticsearch version & lt; = 1
There are so many examples of tires, elasticsearch rail not so many here is a quick start:
# Gemfile gem 'elasticsearch- Model 'gem' elasticsearch-rails ' Install bundle # lib / tasks / elasticsearch.rake to' elasticsearch / rails / tasks / import ' Load your existing model data from DB Elasticsearch:
bundle exec rake environment elasticsearch: import: model class = 'YourModel' # app / model / your_model.rb class YourModel & LT; ActiveRecord :: Base includes Elasticsearch :: Models Elasticsearch :: Models :: Callback and elsewhere in your code (in the system or anywhere you like in the controller or region) Say
# Search with Area Filter @ your_models = YourModel.search (query: {match: {your_field: "whatever"}}). Record # faceted search @your_models = YourModel.search (query: {match: {your_field: "whatever"}} Aspects: {your_facet_name: {rule: {field: "your_facet_field", all_terms: true, order: "term"} }}) # Access to the faceted part of the # elasticsearch response: facet_results = @ your_models..response.response ['facets'] ['your_facet_name'] ['rule'] < / Html>
Comments
Post a Comment