Instantly share code, notes, and snippets.

Embed
What would you like to do?
"products" : {
"product" : {
"properties" : {
"id" : {
"type" : "string",
"index" : "not_analyzed"
},
"product_name" : {
"type" : "string",
"analyzer" : "keyword"
}
}
}
}
{"query":{"bool":{"must":[{"query_string":{"query":"1233","default_operator":"AND"}}]}},"sort":[{"id":"desc"}],"size":5}
def self.search(params, options = {})
tire.search(page: params[:page], per_page: 30) do
query do
boolean do
must { string params[:q], default_operator: "AND" } if params[:q].present?
end
end
sort { by :id, 'desc' }
size options[:size] if options[:size].present?
# raise to_json
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment