title: Laravel elastic search not giving contains or like match
body: <p>I wanted to have elasticsearch implemented for all my laravel search queries. I have the latest Laravel and latest elasticsearch installed using brew.</p>
  
  <p><code>curl http://localhost:9200/</code> gives,</p>
  
  <pre><code>{
    "name" : "_SFvSGk",
    "cluster_name" : "elasticsearch_an398690",
    "cluster_uuid" : "xBi3aTDaTkmA6dtzhpOrwg",
    "version" : {
      "number" : "6.5.4",
      "build_flavor" : "oss",
      "build_type" : "tar",
      "build_hash" : "d2ef93d",
      "build_date" : "2018-12-17T21:17:40.758843Z",
      "build_snapshot" : false,
      "lucene_version" : "7.5.0",
      "minimum_wire_compatibility_version" : "5.6.0",
      "minimum_index_compatibility_version" : "5.0.0"
    },
    "tagline" : "You Know, for Search"
  }
  </code></pre>
  
  <p>Here I am using the <a href="https://github.com/babenkoivan/scout-elasticsearch-driver" rel="nofollow noreferrer">driver</a> <code>babenkoivan/scout-elasticsearch-driver</code>.</p>
  
  <p><strong>Model</strong>,</p>
  
  <pre><code>namespace App;
  
  use ScoutElastic\Searchable;
  use Illuminate\Database\Eloquent\Model;
  
  class Customer extends Model
  {
      use Searchable;
  
      /**
       * @var string
       */
      protected $indexConfigurator = CustomerIndexConfigurator::class;
  
      /**
       * @var array
       */
      protected $searchRules = [
          CustomerSearchRule::class
      ];
  
      /**
       * @var array
       */
      protected $mapping = [
          'properties' =&gt; [
              'text' =&gt; [
                  'type' =&gt; 'text',
                  'fields' =&gt; [
                      'ref_num' =&gt; [
                          'type' =&gt; 'keyword',
                      ]
                  ]
              ],
          ]
      ];
  }
  </code></pre>
  
  <p><strong>SearchRule</strong>,</p>
  
  <pre><code>namespace App;
  
  use ScoutElastic\SearchRule;
  
  class CustomerSearchRule extends SearchRule
  {
      /**
       * @inheritdoc
       */
      public function buildHighlightPayload()
      {
          return [
              'fields' =&gt; [
                  'ref_num' =&gt; [
                      'type' =&gt; 'plain'
                  ]
              ]
          ];
      }
  
      /**
       * @inheritdoc
       */
      public function buildQueryPayload()
      {
          $query = $this-&gt;builder-&gt;query;
  
          return [
                  [
                      'match' =&gt; [
                          'ref_num' =&gt; [
                              'query' =&gt; $query,
                              'boost' =&gt; 2
                          ]
                      ]
                  ]
          ];
      }
  }
  </code></pre>
  
  <p><strong>Configurator</strong>,</p>
  
  <pre><code>namespace App;
  
  use ScoutElastic\IndexConfigurator;
  use ScoutElastic\Migratable;
  
  class CustomerIndexConfigurator extends IndexConfigurator
  {
      use Migratable;
  
      /**
       * @var array
       */
      protected $settings = [
          //
      ];
  }
  </code></pre>
  
  <p>I have a record with <code>ref_num</code> as <code>I50263</code>. So I should get this record when I search <code>I50</code> same like <code>like query</code>. I tried all the below search but I am getting the result only with the complete word <code>I50263</code>.</p>
  
  <pre><code>return Customer::search('I50')-&gt;get();
  // no record
  return Customer::search('I50263')-&gt;get();
  // got record
  return Customer::searchRaw([
    'query' =&gt; [
       'bool' =&gt; [
          'must' =&gt; [
              'match' =&gt; [
                  'ref_num' =&gt; 'I502'
              ]
          ]
       ]
    ]
  ]);
  // no record
  return Customer::searchRaw([
    'query' =&gt; [
        'bool' =&gt; [
            'must' =&gt; [
               "match_phrase" =&gt; [
                  "ref_num" =&gt; [
                     "query" =&gt; "I50",
                     "boost" =&gt; 1
                   ]
                ]
             ]
          ]
       ]
   ]);
   // no record
  </code></pre>
  
  <p>Tried field type as <code>text</code> also.</p>