title: Rails Elasticsearch, Searchkick
body: <p>I just followed <a href="https://shellycloud.com/blog/2013/10/adding-search-and-autocomplete-to-a-rails-app-with-elasticsearch" rel="nofollow noreferrer">this tutorial</a> to add elasticsearch to my app.</p>
  
  <p>I work on a windows 8 system and I have elasticsearch installed. But when i try to search something in my app it doesn't find anything. </p>
  
  <p>In the tutorial they say that I can use the rails console to see if the search is working.</p>
  
  <p>I installed the searchkick gem and run bundle install.</p>
  
  <p>I added searchkick to my Ticket class.</p>
  
  <pre><code>class Ticket &lt; ActiveRecord::Base
    searchkick
    # ...
  end
  </code></pre>
  
  <p>I added my Ticket class to the index</p>
  
  <pre><code>rake searchkick:reindex CLASS=Book
  </code></pre>
  
  <p>When I try to search something in the rails console it find nothing.</p>
  
  <pre><code>irb(main):001:0&gt; results = Ticket.search("computer")
    Ticket Search (103.0ms)
  curl http://lvh.me:9200/tickets_development/_search?pretty -d '{
    "query": {
      "dis_max": {
        "queries": [
          {
            "match": {
              "_all": {
                "query": "computer",
                "operator": "and",
                "boost": 10,
                "analyzer": "searchkick_search"
              }
            }
          },
          {
            "match": {
              "_all": {
                "query": "computer",
                "operator": "and",
                "boost": 10,
                "analyzer": "searchkick_search2"
              }
            }
          },
          {
            "match": {
              "_all": {
                "query": "computer",
                "operator": "and",
                "boost": 1,
                "fuzziness": 1,
                "max_expansions": 3,
                "analyzer": "searchkick_search"
              }
            }
          },
          {
            "match": {
              "_all": {
                "query": "computer",
                "operator": "and",
                "boost": 1,
                "fuzziness": 1,
                "max_expansions": 3,
                "analyzer": "searchkick_search2"
              }
            }
          }
        ]
      }
    },
    "size": 100000,
    "from": 0,
    "fields": []
  }'
  
  =&gt; #&lt;Searchkick::Results:0x6ec5de8 ,
  @klass=Ticket(
    id: integer, 
    name: string, 
    client: string, 
    archived: boolean, 
    created_at: datetime, 
    updated_at: datetime
  )
  @response={
    "took"=&gt; 90,
    "timed_out"=&gt; false,
    "_shards"=&gt; {
      "total"=&gt; 5,
      "successful"=&gt; 5,
      "failed"=&gt; 0
    },
    "hits"=&gt; {
      "total"=&gt; 0,
      "max_score"=&gt; nil,
      "hits"=&gt; []
    }
  },
  @options={
    :page=&gt;1,
    :per_page=&gt;100000, 
    :padding=&gt;0, 
    :load=&gt;true, 
    :includes=&gt;nil, 
    :json=&gt;false
  } &gt; irb(main):002:0&gt; results.map(&amp;:name) =&gt; []
  </code></pre>