Hi,
I've written a gradle plugin that can install, stop and start ElasticSearch. The purpose of this plugin is to help integration testing with ElasticSearch. To learn how to use this plugin please see: https://github.com/amirkibbar/bilberry.
Here's a very short example:
task integrationTests(type: Test) {
    reports {
        html.destination "$buildDir/reports/integration-tests"
    }
    include "**/*IT.*"
    doFirst {
        startElastic {
            httpPort = 9200
            apiPort = 9300
        }
    }
    doLast {
        stopElastic {}
    }
}
Thanks,
Amir