title: Elasticsearch-rails How to increase accuracy in result as expected?
body: <p>I am using elasticsearch-rails and elasticsearch-model gem for searching words in my rails app.</p>
  
  <p>Here is my model <strong>article.rb</strong> where I want to search to take place:</p>
  
  <pre><code>require 'elasticsearch/model'
  
  class Article &lt; ActiveRecord::Base
    include Elasticsearch::Model
    include Elasticsearch::Model::Callbacks
  
    settings index: { number_of_shards: 1 } do
      mappings dynamic: 'false' do
        indexes :title, analyzer: 'english', index_options: 'offsets'
        indexes :text, analyzer: 'english'
      end
    end
  
    def self.search(query)
      __elasticsearch__.search(
        {
          query: {
            multi_match: {
              query: query,
              fields: ['title^10', 'text']
            }
          },
          highlight: {
            pre_tags: ['&lt;em&gt;'],
            post_tags: ['&lt;/em&gt;'],
            fields: {
              title: {},
              text: {}
            }
          }
        }
      )
    end
  end
  
  # Delete the previous articles index in Elasticsearch
  Article.__elasticsearch__.client.indices.delete index: Article.index_name rescue nil
  
  # Create the new index with the new mapping
  Article.__elasticsearch__.client.indices.create \
    index: Article.index_name,
    body: { settings: Article.settings.to_hash, mappings: Article.mappings.to_hash }
  
  # Index all article records from the DB to Elasticsearch
  Article.import
  
  #Article.import force: true
  </code></pre>
  
  <p>Here is my <strong>search.html.erb</strong>:</p>
  
  <pre><code>&lt;h1&gt;Articles Search&lt;/h1&gt;
  
  &lt;%= form_for search_path, method: :get do |f| %&gt;
    &lt;p&gt;
      &lt;%= f.label "Search for" %&gt;
      &lt;%= text_field_tag :q, params[:q] %&gt;
      &lt;%= submit_tag "Go", name: nil %&gt;
    &lt;/p&gt;
  &lt;% end %&gt;
  
  &lt;ul&gt;
    &lt;% @articles.each do |article| %&gt;
      &lt;li&gt;
        &lt;h3&gt;
          &lt;%= link_to article.try(:highlight).try(:title) ? article.highlight.title[0].html_safe : article.title,
            controller: "articles",
            action: "show",
            id: article._id%&gt;
        &lt;/h3&gt;
        &lt;% if article.try(:highlight).try(:text) %&gt;
          &lt;% article.highlight.text.each do |snippet| %&gt;
            &lt;p&gt;&lt;%= snippet.html_safe %&gt;...&lt;/p&gt;
          &lt;% end %&gt;
        &lt;% end %&gt;
      &lt;/li&gt;
    &lt;% end %&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Here is my <strong>routes.rb</strong>:</p>
  
  <pre><code>Rails.application.routes.draw do
    resources :articles
    get 'search', to: 'search#search'
  end
  </code></pre>
  
  <p>Here is my <strong>search_controller.rb</strong>:</p>
  
  <pre><code>class SearchController &lt; ApplicationController
    def search
      if params[:q].nil?
        @articles = []
      else
        @articles = Article.search params[:q]
      end
    end
  end
  </code></pre>
  
  <p>Now, I am getting results only matching words.
  My questions are:
  How I can do composite matching?
  I am not understood how this function works- 
  and how to change queries?? </p>
  
  <pre><code> def self.search(query)
              __elasticsearch__.search(
                {
                  query: {
                    multi_match: {
                      query: query,
                      fields: ['title^10', 'text']
                    }
                  },
                  highlight: {
                    pre_tags: ['&lt;em&gt;'],
                    post_tags: ['&lt;/em&gt;'],
                    fields: {
                      title: {},
                      text: {}
                    }
                  }
                }
              )
            end
          end
  </code></pre>
  
  <p>also How can I increase accuracy like composite match, spell check, partial matching? 
  Thank You.</p>