tire

Ensuring ElasticSearch is in Sync with Database

陌路散爱 提交于 2019-12-24 03:23:27
问题 I'm considering a daily script to do the following, in order to account for any situations where there was a problem with updates on the ES server (I don't yet have a high-availability setup and even so, it's still probably a good practice in a situation where data is being duplicated between DB and ES). Before putting this script together, I thought I'd check if I'm going about this the right way, and whether there are any libraries or techniques I should use. The script will simply retrieve

No handler found for uri [/<index>/<type>/] and method [POST]

情到浓时终转凉″ 提交于 2019-12-23 02:58:36
问题 Hi i am working on a RoR project with ruby-2.4.0 and rails 5. I am using elasticsearch for searching in my app. I have a model venue_details as follows:- class VenueDetail < ActiveRecord::Base include Tire::Model::Search include Tire::Model::Callbacks settings index: { number_of_shards: 1, number_of_replicas: 0, } do mapping do indexes :id, :index => :not_analyzed indexes :venue_name, :type => 'string', :index => :analyzed end end def self.search(params) if params[:query].present? tire.search

How to prevent attachments from being stored in _source with Elasticsearch and Tire?

天涯浪子 提交于 2019-12-21 19:24:54
问题 I've got some PDF attachments being indexed in Elasticsearch, using the Tire gem. It's all working great, but I'm going to have many GB of PDFs, and we will likely store the PDFs in S3 for access. Right now the base64-encoded PDFs are being stored in Elasticsearch _source, which will make the index huge. I want to have the attachments indexed, but not stored, and I haven't yet figured out the right incantation to put in Tire's "mapping" block to prevent it. The block is like this right now:

using elasticsearch to filter through tags with whitespace

家住魔仙堡 提交于 2019-12-21 06:06:52
问题 I am using tire (https://github.com/karmi/tire) with mongoid. Here is my model definition: class SomethingWithTag include Mongoid::Document include Mongoid::Timestamps field :tags_array, type: Array include Tire::Model::Search include Tire::Model::Callbacks mapping do indexes :tags_array, type: :array, index: :not_analyzed end end Say I have a document {tags_array: ["hello world"]}. Then the following queries work fine: SomethingWithTag.tire.search { filter :terms, :tags_array => ["hello"] }

How do I set the default analyzer for elastic search with tire?

这一生的挚爱 提交于 2019-12-19 03:39:14
问题 I have been experimenting with elasticsearch lately with ruby on rails. I am having trouble getting my data indexed so I can search for items with both plural, and non-plural keywords. Tire will allow me to assign an analyzer per mapping attribute: mapping do indexes title, analyzer: 'snowball' indexes body, analyzer: 'snowball' end Now, say I have a keyword in the title of 'tests' if I do a search with the attribute in the query: http://localhost:9200/myindex/mymapping/_search?q=title:test

Analyzers in elasticsearch

不羁岁月 提交于 2019-12-17 21:44:07
问题 I'm having trouble understanding the concept of analyzers in elasticsearch with tire gem. I'm actually a newbie to these search concepts. Can someone here help me with some reference article or explain what actually the analyzers do and why they are used? I see different analyzers being mentioned at elasticsearch like keyword, standard, simple, snowball. Without the knowledge of analyzers I couldn't make out what actually fits my need. 回答1: Let me give you a short answer. An analyzer is used

Elastic search : Searching for integers with wildcards

人走茶凉 提交于 2019-12-13 06:29:54
问题 I am currently using the tire client for elastic search. Lets say I have a field which is indexed as a field of type long in my elastic search mapping. I am trying to achieve something like this: search.query {|query| query.string "30*", :fields => ['id']} Here 'id' is the long field about which I was talking about. But since I specify the fields in the query, the wildcard doesn't work and I end up getting the exact match as the only result. But doing the same thing works with the _all search

Elasticsearch requires*all* associations to be mapped?

一个人想着一个人 提交于 2019-12-13 04:27:43
问题 I have one massive model (It basically is my entire app). I have 7 or more associations on this model, including many to many, :through => etc. This model also has a few simple attributes (title, url, and so on). The only thing I care about indexing are those 3 or 4 simple attributes (title, url, description, category). The rest I don't care about. Everything works perfectly when I use load: true , but as soon as I turn that off everything breaks. The only way to fix this it seems is to go in

ElasticSearch with Tire doesn't include custom analyzer with STI model

人走茶凉 提交于 2019-12-13 03:24:15
问题 I have an STI model which I want to be searchable with ElasticSearch and Tire. The issue I am having is when Tire creates the mappings it seems to ignore my custom analyzers for the second model. Below is an example of my models. class Account < ActiveRecord::Base attr_accessible :name, :type include Tire::Model::Search include Tire::Model::Callbacks tire.settings :analysis => { :analyzer => { "custom_search_analyzer" => { "tokenizer" => "keyword", "filter" => "lowercase" }, "custom_index

Error using Tire persistence

拈花ヽ惹草 提交于 2019-12-12 18:40:52
问题 I have an ActiveAdmin app with a simple model that I want to persist in Elastic Search with Tire: class Person include Tire::Model::Persistence property :firstName property :lastName end But I get this error on the index action: NoMethodError (undefined method `quoted_table_name' for Person:Class) What have I missed? 回答1: First of all, I skipped a few steps enabling Tire persistence. Thanks to Chris Berkhout's post on this topic my model now looks like this: class Person include Tire::Model: