@Override
public void handleRequest(final RestRequest request, final RestChannel channel, Client client) {
final GetIndexedScriptRequest getRequest = new GetIndexedScriptRequest(getScriptLang(request), request.param("id"));
getRequest.version(request.paramAsLong("version", getRequest.version()));
getRequest.versionType(VersionType.fromString(request.param("version_type"), getRequest.versionType()));
client.getIndexedScript(getRequest, new RestResponseListener<GetIndexedScriptResponse>(channel) {
@Override
public RestResponse buildResponse(GetIndexedScriptResponse response) throws Exception {
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
if (!response.isExists()) {