How to limit the total returned results when using ElasticSearch with Tire (A Ruby on Rails Gem)? How to limit the total returned results when using ElasticSearch with Tire (A Ruby on Rails Gem)? elasticsearch elasticsearch

How to limit the total returned results when using ElasticSearch with Tire (A Ruby on Rails Gem)?


You can specify the size option with the extended query DSL:

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

Or you can set the :per_page option

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