7

I tried to use Post.search(keyword, :size => 10) and Post.search(keyword).size(10). but non of these will work.

4

1 回答 1

14

您可以使用size扩展查询 DSL 指定选项:

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

或者您可以设置:per_page选项

Post.search(keyword, :per_page => 10)
于 2013-01-12T15:51:23.347 回答