elastic/elasticsearch-rails

Custom tracer doesn't seem to work with Kaminari pagination

tsrivishnu opened this issue · 1 comments

I have the following setup in the initialiser:

  tracer = ActiveSupport::Logger.new("log/elasticsearch.log")
  tracer.level = Logger::DEBUG
  Elasticsearch::Model.client = Elasticsearch::Client.new(
    hosts: ELASTICSEARCH_HOSTS,
    tracer: tracer
  )

# Paginate Elasticsearch searches directly on Elasticsearch with Kaminari
# see : https://github.com/elastic/elasticsearch-rails/tree/main/elasticsearch-model#pagination
Kaminari::Hooks.init if defined?(Kaminari::Hooks)
Elasticsearch::Model::Response::Response.include Elasticsearch::Model::Response::Pagination::Kaminari

When I run Model.__elasticsearch__.search(query) it prints the CURL and other logs to log/elasticsearch.log

However, when I run Model.__elasticsearch__.search(query).page(1).per(10), nothing is printed to log/production.log.

Environment

  • Rails - 6.1.3.2
  • Elasticsearch-rails - 7.2.0
  • Elasticsearch-model - 7.2.0
  • Elasticsearch (Ruby gem) - 7.16.3
  • Elasticsearch (instance) - 7.16.3

Apologies. Seems like to be delays with the file sync from the docker container.

This works correctly as expected.