I am doing bulk indexing using Tire Gem as the client for Elasticsearch
index = Tire::Index.new('oldskool')
index.bulk_store(bulk_values)
I monitor the HTTP connections on my Elasticsearch cluster by using the http monitor API,
curl 'localhost:9200/_nodes/http/stats'
In the JSON response that I get ,
..."http":{"current_open" : 10, "total_opened" : 18345}
I observed that the "total_opened" field value goes on increasing rapidly. I think this means that the Tire gem is not using persistent connections while bulk indexing( Please correct me if I am wrong ).
How can I use Tire Gem to make persistent connections with Elasticsearch while doing bulk indexing?
By default Tire
uses RestClient
which doesn't support keep-alive
. You can switch to curb client by configuring Tire
for example like this.
require 'tire/http/clients/curb'
Tire.configure do
client Tire::HTTP::Client::Curb
end