title: how to implement partial word match for result using elastic search in rails
body: <p>i am new to elastic search and want to implement partial word match in my application don't know how to implement please suggest me my code is as follows:</p>
  
  <p>article.rb file</p>
  
  <pre><code>    class Article &lt; ActiveRecord::Base
          include Tire::Model::Search
        include Tire::Model::Callbacks
  
  
        settings analysis: {
          filter: {
            ngram_filter: { type: "nGram", min_gram: 2, max_gram: 12 }
          },
          analyzer: {
            partial_analyzer: {
              type: "snowball",
              tokenizer: "standard",
              filter: ["standard", "lowercase", "ngram_filter"]
            }
          }
        } do
          mapping do
            indexes :title, index_filter: "ngram_filter"
            indexes :body, index_analyzer: "partial_analyzer"
            indexes :id
          end
        end
        def self.search(params)
          tire.search() do
            query { string params[:query]} if params[:query].present?
          end
        end
      end
  
  article_controller.rb
  
      class ArticlesController &lt; ApplicationController
        def index
           if params[:query].present?
              @articles = Article.search(params)
              # @articles = Article.where(title: params["query"])
           else
              @articles = Article.all
           end
  
           respond_to do |format|
              format.js { render :layout =&gt; false }
              format.html 
  
           end
  
        end
      end
  </code></pre>
  
  <p>i also don't have much knowledge about mapping r indexing so please suggest me solution, thanx in advance.</p>