Custom mapping with elasticsearch

Tag: elasticsearch , tire Author: godblssyou Date: 2013-06-24

I have a question about elasticsearch, which I'm running off of karmi's tire API. I have a database of submissions and would like to index their titles omitting stopwords. I've gone ahead and wrote a customized mapping protocol that looks like this:

class Submission < ActiveRecord::Base
# include required modules
include Tire::Model::Search
include Tire::Model::Callbacks
# Custom Mapping for Elastic Search
    tire.mapping do
      indexes :title, analyzer: 'standard'
    end 

    # tire elastic search for search
    [email protected] [String] params search terms
    [email protected] the default operator of our elastic search is "OR" and result pages or 15 results long
def self.search(params)
 tire.search(load: true, page: params[:page], per_page: 15) do
  query do
   boolean do
    must { string params[:q]+"*", default_operator: "AND" } if params[:q].present?
    must { term :deleted, false }
   end
  end
 end
end

When I didn't have the custom mapping, elasticsearch was cooperative: it searched all submission (title, content etc.) and included all words (incl. stopwords). The problem is that once I include the custom mapping and re-index the submissions, none of the records are showing up in elasticsearch.

Thank you!

Don't know much about tire, but what does your mapping look like? Can you post the json that you get back from the get mapping api?