module Pagy::ElasticsearchRailsExtra::ModelExtension

def pagy_elasticsearch_rails(query_or_payload, **options)

It also pushes to the same array an optional method call.
after the pagination variables are merged to the options.
Return an array used to delay the call of #search
:nodoc:
def pagy_elasticsearch_rails(query_or_payload, **options)
  [self, query_or_payload, options].tap do |args|
    args.define_singleton_method(:method_missing) { |*a| args += a }
  end
end