Skip to content

Instantly share code, notes, and snippets.

@rubish
Created October 9, 2011 23:57
Show Gist options
  • Save rubish/1274393 to your computer and use it in GitHub Desktop.
Save rubish/1274393 to your computer and use it in GitHub Desktop.
Tire/curl inconsistency
pry(main)> UserFilter.new(:college => College.first, :user_type => User::ALUMNI).tire_name_facets('virgil')
=> {"name"=>{"_type"=>"terms", "missing"=>0, "total"=>0, "other"=>0, "terms"=>[]}}
rubish@rubish:~$ curl -X GET "http://localhost:9200/development_users/user/_search?pretty=true" -d '{"sort":[{"profile_completeness":"desc"},{"created_at":"asc"}],"facets":{"name":{"terms":{"field":"personal_info.name.untouched","size":100,"all_terms":false},"facet_filter":{"and":[{"term":{"college_id":"4e74530e75f38e7ef200000b"}},{"missing":{"field":"invitation_token"}},{"term":{"user_type":"alumni"}},{"query":{"query_string":{"query":"personal_info.name:'virgil'"}}}]}}},"size":0,"from":0}'
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 3268,
"max_score" : null,
"hits" : [ ]
},
"facets" : {
"name" : {
"_type" : "terms",
"missing" : 0,
"total" : 1,
"other" : 0,
"terms" : [ {
"term" : "Virgil Trantow",
"count" : 1
} ]
}
}
}
# 2011-10-10 05:14:01:391 [_search] (["development_users"])
#
curl -X GET "http://localhost:9200/development_users/user/_search?pretty=true" -d '{"sort":[{"profile_completeness":"desc"},{"created_at":"asc"}],"facets":{"name":{"terms":{"field":"personal_info.name.untouched","size":100,"all_terms":false},"facet_filter":{"and":[{"term":{"college_id":"4e74530e75f38e7ef200000b"}},{"missing":{"field":"invitation_token"}},{"term":{"user_type":"alumni"}},{"query":{"query_string":{"query":"personal_info.name:'virgil'"}}}]}}},"size":0,"from":0}'
# 2011-10-10 05:14:01:394 [200] (2 msec)
#
# {"took":2,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":3268,"max_score":null,"hits":[]},"facets":{"name":{"_type":"terms","missing":0,"total":0,"other":0,"terms":[]}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment