How to limit general returned results when using ElasticSearch with a bus (A Ruby on Rails Gem)?

I tried using Post.search(keyword, :size => 10) and Post.search(keyword).size(10) . but will not work.

+7
source share
1 answer

You can specify the size option with an extended DSL request:

 Post.search do query { string keyword } size 10 end 

Or you can set the option :per_page

 Post.search(keyword, :per_page => 10) 
+14
source

All Articles