karmi/tire — Issue #128: Tire returns no hits
Author: ellmo
Created: 2011-10-17 17:58:50+00:00
State: open

I have an application that uses tire, and the communication works on co-worker`s computer and on a staging server. I have the same issue on two on my computers: one running Ubuntu, other one OSX.

Elasticsearch is working, I can communicate with it through curl commands. I can create indices and store data in them and I can retrieve them through curl or browser.

When I use Tire to take care of this:

```bash
$ rake environment tire:import CLASS='Deal'
[IMPORT] Creating index 'deals' with mapping:
{"deal":{"properties":{}}}
# 2011-10-17 19:47:47:251 [CREATE] ("deals")
#
curl -X POST "http://localhost:9200/deals" -d '{"mappings":{"deal":{"properties":{}}}}'

# 2011-10-17 19:47:47:251 [200]

[IMPORT] Starting import for the 'Deal' class
--------------------------------------------------------------------------------
352/352 | 100% # 2011-10-17 19:47:50:783 [BULK] ("deals")#########
#
curl -X POST "http://localhost:9200/_bulk" -d '{... data omitted ...}'

# 2011-10-17 19:47:50:783 [200]

================================================================================
Import finished in 3.53648 seconds
```

But still
```ruby
Deal.tire.search '*'

# 2011-10-17 19:56:37:127 [_search] (["deals"])
#
curl -X GET "http://localhost:9200/deals/deal/_search?pretty=true" -d '{"query":{"query_string":{"query":"*"}}}'

# 2011-10-17 19:56:37:127 [200] (17 msec)

=> #17, "timed_out"=>false, "_shards"=>{"total"=>5, "successful"=>5, "failed"=>0}, "hits"=>{"total"=>0, "max_score"=>nil, "hits"=>[]}}, @options={:type=>"deal"}, @time=17, @total=0, @facets=nil, @wrapper=Tire::Results::Item>
```

And:
```bash
curl -XGET 'http://localhost:9200/deals/deal/1'
```
returns
```bash
{"_index":"deals","_type":"deal","_id":"1","exists":false}
```