Skip to content

Instantly share code, notes, and snippets.

@sgringwe
Last active August 29, 2015 14:00
Show Gist options
  • Save sgringwe/11384161 to your computer and use it in GitHub Desktop.
Save sgringwe/11384161 to your computer and use it in GitHub Desktop.
Using Elasticsearch and tire gem in rails integration specs
# For using elasticsearch in specs. This (hopefully) solves the issue of brittle tests
# from elasaticsearch's refresh interval of 1 second.
# -1 for instant refresh:
# => http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/index-modules.html
# 30 merge factor for faster index creation:
# => http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/index-modules-merge.html
RestClient.put "#{ENV['ELASTICSEARCH_URL']}/_settings ", %<{
"index" : {
"refresh_interval" : "-1",
"merge.policy.merge_factor" : 30
}
}>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment