tire

Elasticsearch: How to search with different analyzers?

这一生的挚爱 提交于 2019-12-08 06:07:03
问题 I'm using my custom analyzer autocomplete_analyzer with filter edgeNGram . So mapping looks like: "acts_as_taggable_on_tags" : { "acts_as_taggable_on/tag" : { "properties" : { "name" : { "type" : "string", "boost" : 10.0, "analyzer" : "autocomplete_analyzer" } } } } When I search using query_string , it works like autocomplete. For example, query "lon" returns ["lon", "long", "london",...]. But sometimes I need exact matching. How can I get just one exactly matching word "lon"? Can I use

Update ElasticSearch mapping in production (Tire)

雨燕双飞 提交于 2019-12-07 19:23:08
问题 I would like to have a clear understanding on how to deal with the following scenario: I'm adding or removing an attribute from an activerecord model, so I want to update its mapping in ElasticSearch, in production. From what I understood, I should... 1- create a new index and import everything from mysql Is this the right command? rake environment tire:import CLASS='Bow' INDEX='new-bows' For this to create the right mapping, I should already have updated my mapping in the model, right? 2-

Find open Shops through Timetable with Elasticsearch/Tire

妖精的绣舞 提交于 2019-12-07 04:26:14
问题 I have model Shop each has relation with Timetable which could contain something like: shop_id: 1, day: 5, open_hour: 7, open_minutes: 0, close_hour: 13, close_minute: 30 shop_id: 1, day: 5, open_hour: 14, open_minutes: 30, close_hour: 18, close_minute: 00 of course Timetable could have more elegant format, but question is next: how with elasticsearch(tire) could I find Shop which is open? all Idea will be apreciated! Thanks! Found solution: create separate index for each day (sunday, monday,

Update ElasticSearch mapping in production (Tire)

被刻印的时光 ゝ 提交于 2019-12-06 10:51:38
I would like to have a clear understanding on how to deal with the following scenario: I'm adding or removing an attribute from an activerecord model, so I want to update its mapping in ElasticSearch, in production. From what I understood, I should... 1- create a new index and import everything from mysql Is this the right command? rake environment tire:import CLASS='Bow' INDEX='new-bows' For this to create the right mapping, I should already have updated my mapping in the model, right? 2- delete the old mapping and create an alias named bows for new-bows I would do it like that, is it correct

How do you index attachment in Elasticsearch with Tire?

江枫思渺然 提交于 2019-12-06 10:15:00
问题 Having difficulty indexing an attachment type in elasticsearch via the Tire gem. Not able to set attachment type correctly. I've taken ActiveModel Integration example referenced from the Tire gem and added a field, filename , to reference name of PDFs on local filesystem that I want to index with the record. #app/models/article.rb class Article < ActiveRecord::Base include Tire::Model::Search include Tire::Model::Callbacks attr_accessible :title, :content, :published_on, :filename mapping do

ceph cache pool配置

半腔热情 提交于 2019-12-06 08:16:52
0.引入 本文介绍如何配置cache pool tiering. cache pool的作用是提供可扩展的cache,用来缓存ceph的热点数据或者直接用来作为高速pool。如何建立一个cache pool:首先利用ssd盘做一个虚拟的bucket tree, 然后创建一个cache pool,设置其crush映射rule和相关配置,最后关联需要用到的pool到cache pool。 1.建立ssd bucket tree 这 是新增ssd bucket(vrack)后的osd tree。其中osd.1 osd.0 osd.2使用的是ssd盘。如何创建将简单,无非是调整或新增osd到bucket tree下。 # ceph osd tree ID WEIGHT TYPE NAME UP/DOWN REWEIGHT PRIMARY-AFFINITY -1 6.00000 root default -2 6.00000 room test -3 3.00000 rack r1 -7 1.00000 host H09 3 1.00000 osd.3 up 1.00000 1.00000 -9 1.00000 host H07 5 1.00000 osd.5 up 1.00000 1.00000 -10 1.00000 host H06 6 1.00000 osd.6 up 1.00000

Elasticsearch with Tire: edgeNgram with multiple words

喜欢而已 提交于 2019-12-05 20:00:46
Let's say I have 5 film titles: Sans Soleil Sansa So Is This Sol Goode Sole Survivor I want to implement an auto-complete search field with this expected behavior: "Sans" > Sans Soleil, Sansa "Sans so" > Sans Soleil "So" > So Is This, Sol Goode, Sole Survivor "So Is" > So Is This "Sol" > Sol Goode, Sole Survivor, Sans Soleil This use-case seems obvious and must be one utilized by many, but I just can't get it to work properly and I can't seem to find any answer or documentation to help. This is my current model: class Film < Media include Tire::Model::Search include Tire::Model::Callbacks

Symbols in query-string for elasticsearch

二次信任 提交于 2019-12-05 17:38:20
问题 I have "documents" (activerecords) with an attribute called deviations. The attribute has values like "Bin X" "Bin $" "Bin q" "Bin %" etc. I am trying to use tire/elasticsearch to search the attribute. I am using the whitespace analyzer to index the deviation attribute. Here is my code for creating the indexes: settings :analysis => { :filter => { :ngram_filter => { :type => "nGram", :min_gram => 2, :max_gram => 255 }, :deviation_filter => { :type => "word_delimiter", :type_table => ['$ =>

How do you index attachment in Elasticsearch with Tire?

霸气de小男生 提交于 2019-12-04 15:33:04
Having difficulty indexing an attachment type in elasticsearch via the Tire gem. Not able to set attachment type correctly. I've taken ActiveModel Integration example referenced from the Tire gem and added a field, filename , to reference name of PDFs on local filesystem that I want to index with the record. #app/models/article.rb class Article < ActiveRecord::Base include Tire::Model::Search include Tire::Model::Callbacks attr_accessible :title, :content, :published_on, :filename mapping do indexes :id, :type =>'integer' indexes :title indexes :content indexes :published_on, :type => 'date'

Elastic Search/Tire: How to map to association attribute?

别说谁变了你拦得住时间么 提交于 2019-12-04 11:25:37
I'm using Tire for Elastic Search. In my application I have 2 models; Price and Product. I'm trying to search my Price class and use the Product it belongs to's :name attribute for the search field. Right now if I had a product called Product 1 and type in "pro", "prod" or "duct", no results come up. But typing "product" or "Product" shows the results. I believe the problem lies in my mapping. I looked at the query and its: ...localhost:3000/search/results?utf8=%E2%9C%93&query=product When I think it should be: ...localhost:3000/search/results?utf8=%E2%9C%93&query:product=product Judging by