Questions tagged [elasticsearch-rails]

Ruby and Rails integrations for Elasticsearch

Ruby and Rails integrations for Elasticsearch:

  • ActiveModel integration with adapters for ActiveRecord and Mongoid
  • Repository pattern based persistence layer for Ruby objects Active
  • Record pattern based persistence layer for Ruby models
  • Enumerable-based wrapper for search results
  • ActiveRecord::Relation-based wrapper for returning search results as records
  • Convenience model methods such as search, mapping, import, etc
  • Rake tasks for importing the data Support for Kaminari and WillPaginate pagination
  • Integration with Rails' instrumentation framework

https://github.com/elastic/elasticsearch-rails

117 questions
3
votes
1 answer

Nested sorting not working as expected ElasticSearch

Requirement sort product with custom_field_values matching custom_field_id Mapping { "mapping": { "product": { "properties": { "user_id": { "type": "integer" } "custom_field_values": { …
3
votes
1 answer

Spell check Ngram for elastic Search not working with rails

I have used in my model to include spell check such that if the user inputs data like "Rentaal" then it should fetch the correct data as "Rental" document.rb code require 'elasticsearch/model' class Document < ApplicationRecord include…
3
votes
0 answers

elasticsearch rails searching models

I am using elasticsearch-rails and elasticsearch-model gem for searching products in my rails app. I want to make my search case insensitive and must be independent of pluralization. I researched a lot on google but got a hunch on how to do it using…
Gagan
  • 4,278
  • 7
  • 46
  • 71
3
votes
0 answers

Elasticsearch - Auto-import records from Active Record model

System: Rails 4 Ruby 2 Elasticsearch 1.6.0 I'm using Elasticsearch to filter records and calculate statistics for my Active Record models. I'd like my Elasticsearch indices to mirror my Postgres database so that existing records are imported into…
2
votes
1 answer

Handle large amount of shards in elasticsearch

Every shop has its own set of inventory which is stored in elasticsearch as one index. Currently, I have 11 thousand shops that mean it has 11 thousand shards with indices which are difficult to fetch data in 32 GB ram server. Can someone guide how…
Beena Shetty
  • 3,676
  • 2
  • 28
  • 31
2
votes
1 answer

ElasticSearch Nested Query - exclude parent document

Trying to exclude top-level documents where one of the child documents doesn't match the query. For the example below, I'm trying to exclude all documents where one of its nested jobs has current: true, and matches with the company name: Elastic.…
2
votes
1 answer

Ruby on Rails - ElasticSearch Result window is too large

I'm using the elasticsearch-rails gem. I'm getting the following error when a user clicks a higher page number link in my pagination. Here is the error: Elasticsearch::Transport::Transport::Errors::InternalServerError ([500]…
Cannon Moyer
  • 3,014
  • 3
  • 31
  • 75
2
votes
1 answer

Elastic Search not displaying data in rails

I have a document model and I am using elastic search on it My document model is as Follows require 'elasticsearch/model' class Document < ApplicationRecord include Elasticsearch::Model include Elasticsearch::Model::Callbacks …
2
votes
1 answer

ElasticsearchIllegalArgumentException[suggester [completion] requires context to be setup]

I am using Elastic Search to implement an autosuggest field for an index called people: The Mapping is as below for the field person_name_suggest - person_name_suggest: { type: "completion", analyzer: "simple", payloads: true, …
Michael Victor
  • 861
  • 2
  • 18
  • 42
2
votes
1 answer

Elasticsearch for mysql view rails

How to create an elasticsearch index for a view in MYSQL ? I tried making a model for a migration of a mysql view and in the model put include Elasticsearch::Model include Elasticsearch::Model::Callbacks and put in elasticsearch.rb unless…
2
votes
0 answers

Elasticsearch - Dynamic mappings are not available on the node that holds the primary yet

We have a rails application that is using the official elasticsearch gem to connect to elasticsearch. I did a deploy which simply added one field (number) to the index (by editing the model + adding it to as_indexed_json) and would query by this…
Geesu
  • 5,928
  • 11
  • 43
  • 72
2
votes
0 answers

How do elasticsearch-rails mappings translate into elasticsearch index configuration?

I'm using elasticsearch-rails (elasticsearch-model) gem and I'm getting a bit confused about how the model-dsl ultimately translates into an index configuration. I'm having the following code to directly set up the index, and it works fine: require…
2
votes
2 answers

Elasticsearch filter the maximum value document

I trying to get the maximum value of document from the same name records. Forexample, I have 3 users, 2 of them have same name but different followers count, I wanted to return only 1 document from the 2 same with same name based on the maximum of…
2
votes
1 answer

How to import parent/child objects in Elasticsearch

I'm using the gems elasticsearch-rails and elasticsearch-model in my Rails app. I'm using this integration test as a template for setting up my mappings and such before importing existing data, which has the same basic association between the parent…
2
votes
1 answer

Elasticsearch DSL with multiple multi_match query in ruby

I have this scenario wherein there are two multi_match searches within the same query. The trouble is, when I create the JSON for it in ruby, a json with non-unique keys doesn't seem possible so only one of them appear. Here is my query: { …
shikhar.ja
  • 457
  • 1
  • 4
  • 11