I can't reproduce the issue locally, but instead of the current line, try:

    sh "curl -sXPOST 'http://localhost:9200/_all/_refresh' > /dev/null"

Learn more: http://www.elasticsearch.org/guide/reference/api/admin-indices-refresh/