Created
August 21, 2012 09:54
-
-
Save xeago/3414106 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'Tire' | |
search = Tire.search('videos') | |
search.filter :term, "status" => "REMOVED" | |
# search.size 100 | |
p search.results.map.all? {|v| v.status == "REMOVED" } | |
search.results.map.each { |v| puts v.status } | |
puts search.to_curl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tire.index 'videos' | |
create :mappings => { | |
:video => { | |
:properties => { | |
:id => {:index => :not_analyzed}, | |
:user_id => {:index => :not_analyzed}, | |
:likes => {:index => :not_analyzed, :type => 'integer'}, | |
:title => {:type => 'string', :analyzer => 'keyword'}, | |
:tags => {:type => 'string', :analyzer => 'keyword'}, | |
:status => {:type => 'string', :analyzer => 'keyword' }, | |
:user_status => {:type => 'string', :analyzer => 'keyword' }, | |
:playable => {:type => 'boolean', :analyzer => 'keyword'}, | |
:manual_check => {:type => 'string', :analyzer => 'keyword' }, | |
:auto_check => {:type => 'boolean'}, | |
:created_at => {:type => 'date' }, | |
:published_at => {:type => 'date' } | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
false | |
REMOVED | |
REMOVED | |
REMOVED | |
PUBLISHED | |
PUBLISHED | |
PUBLISHED | |
NOT_PUBLISHED | |
REMOVED | |
PUBLISHED | |
REMOVED | |
curl -X GET "http://localhost:9200/videos/_search?pretty=true" -d '{"filter":{"term":{"user_status":"DISABLED"}}}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment