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
0
votes
1 answer

Yield/add search term to ElasticSearch results

I'm doing a ElasticSearch query with multiple terms constructed dynamically, so it looks like this: ... must: [ { terms: { tags_slug: ['term_a', 'term_b'] } }, ... ] ... everything works fine, but I'd like to add to each result, the term that…
Karol Karol
  • 566
  • 3
  • 7
  • 26
0
votes
0 answers

Is there any alternate way instead of nested type in elasticsearch(6.0.1)

We have nested type mapping in my index which has around 4 million documents in one index. Below is the mapping with example. Using Elasticsearch 6.0.1 "mappings": { "inventory": { "name" : { "type" : "text" }, "id" : { …
Beena Shetty
  • 3,676
  • 2
  • 28
  • 31
0
votes
1 answer

Filtering Elastic search result with must and match giving unexpected result

{ "body": { "query": { "bool": { "must": { "match": { "_id": "24" } }, "should": [ { "term": { "draft_id": "draft_11" } }, …
przbadu
  • 5,769
  • 5
  • 42
  • 67
0
votes
2 answers

Elasticsearch match field=value (not contains)

I have problem while searching through elasticsearch. I have index product with fields title and gender When I make query with default_field: title I need to get results only with gender=male (not female or others) query: dress AND gender:male…
0
votes
1 answer

Prevent Keyword Stuffing Elasticsearch

I'm using ES 7.3. I have a product index with titles, part, model numbers, etc. I am having issues with keyword stuffing because some of the products might contain the same word, part or model number multiple times throughout the document. For…
Cannon Moyer
  • 3,014
  • 3
  • 31
  • 75
0
votes
1 answer

Elasticsearch two multi_match queries

I have three fields name, name.ngram and model_number that I am trying to search. I have boosted name so any match on name ranks higher than name.ngram. However, I still have some cases where the name.ngram doesn't match with terms that contain…
Cannon Moyer
  • 3,014
  • 3
  • 31
  • 75
0
votes
1 answer

ElasticSearch maxClauseCount is set to 1024

I'm using the elasticsearch-rails gem in Rails 5 and I am trying to increase the max_clause_count. I'm using version 7.3 of ElasticSearch. In my elasticsearch.yml file I have added the following code: indices.query.bool.max_clause_count: 4096 In…
Cannon Moyer
  • 3,014
  • 3
  • 31
  • 75
0
votes
1 answer

Rails-elasticsearch: unable to perform custom mapping content of the table

I am trying to make a custom index of my model to elasticsearch serwer. Somehow I can render only a structure (selected columns) but without a records. My model: require 'elasticsearch/model' class Lead < ApplicationRecord include…
andrzej541
  • 919
  • 1
  • 9
  • 21
0
votes
1 answer

ElasticSearch Aggregator with sorting by text/keyword

I have elasticsearch set up for searching across a products catalog's variants. Basically where: Product has_many variants Variant belongs_to product And the variant index json / mapping contains the product name. I am trying to search variants,…
Marcelo Ribeiro
  • 1,718
  • 1
  • 13
  • 27
0
votes
1 answer

ElasticSearch Missing definition for aggregation [unique_users] Error

I am using ES with Ruby on Rails, I am in a situation where I have to list all unique users so below is the code that I am using to get it. buckets['unique_users'] = { filter: { match_all: {} }, aggregations: { …
0
votes
1 answer

ElasticSearch show data according to restaurant_id and its average time

I am very new to ElasticSearch and I wonder if it is possible to show the data according to restaurant_id and then the average time to confirm the order. for example, I have documents: { _index: "orders-development", _type: "order", _id:…
0
votes
1 answer

ElasticSearch apply limit on bucket results

I am in a situation where I have applied limit for the ElasticSearch results but it's not working for me. I have gone through the ES guide below is my code: module Invoices class RestaurantBuilder < Base def query(options = {}) …
0
votes
0 answers

Elasticsearch not indexing child document - Ruby on Rails

I'm using the elasticsearch-rails gem and my order objects aren't being fully indexed on create. Here is my code: after_commit on: [:create] do begin __elasticsearch__.index_document rescue Rails.logger.error "Elastic Search error…
Cannon Moyer
  • 3,014
  • 3
  • 31
  • 75
0
votes
0 answers

Schema-less indexing search

I have a set of data following a similar data structure below: { "first_name": "some_value", "last_name": "some_value_2", "instance": "some_instance" "num_of_tries": 159, "uuid": "some_uuid", "background": "something the user…
Sean
  • 2,496
  • 7
  • 32
  • 60
0
votes
1 answer

Elasticsearch-rails Multi Match Query Not Working

I'm about sick of ES. Nothing ever works. With that said here is my next issue with ES. I'm using the elasticsearch-rails gem. When I run a curl command I can query with a multi_match and get the expected results like this: curl -XGET…
Cannon Moyer
  • 3,014
  • 3
  • 31
  • 75