Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Commit

Permalink
remove export
Browse files Browse the repository at this point in the history
  • Loading branch information
iamazy committed May 9, 2019
1 parent eece02a commit 8f84339
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 86 deletions.
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
<url>https://github.com/iamazy/elasticsearch-sql</url>

<properties>
<elasticsearch.version>7.0.1</elasticsearch.version>
<elasticsearch.version>7.0.0</elasticsearch.version>
<java.version>1.8</java.version>
<maven.compiler.target>${java.version}</maven.compiler.target>
<elasticsearch.plugin.name>isql</elasticsearch.plugin.name>
<elasticsearch.plugin.classname>io.github.iamazy.elasticsearch.dsl.plugin.SqlPlugin</elasticsearch.plugin.classname>
<elasticsearch.plugin.jvm>true</elasticsearch.plugin.jvm>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.iamazy.elasticsearch.dsl.plugin;

import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import io.github.iamazy.elasticsearch.dsl.sql.exception.ElasticSql2DslException;
import io.github.iamazy.elasticsearch.dsl.sql.model.ElasticSqlParseResult;
import io.github.iamazy.elasticsearch.dsl.sql.parser.ElasticSql2DslParser;
Expand All @@ -13,6 +14,7 @@
import org.elasticsearch.rest.*;

import java.io.IOException;
import java.util.concurrent.*;


/**
Expand All @@ -30,14 +32,13 @@ public class RestSqlAction extends BaseRestHandler {
restController.registerHandler(RestRequest.Method.GET, "/_isql", this);
}


@Override
public String getName() {
return "isql";
}

@Override
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient nodeClient) throws IOException {
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient nodeClient) {
try (XContentParser parser = restRequest.contentOrSourceParamParser()) {
parser.mapStrings().forEach((k, v) -> restRequest.params().putIfAbsent(k, v));
} catch (IOException e) {
Expand All @@ -54,9 +55,6 @@ protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient
if (restRequest.path().endsWith("/_explain")) {
return channel -> channel.sendResponse(new BytesRestResponse(RestStatus.OK, builder.value(parseResult.toRequest().source())));
}
else if(restRequest.path().endsWith("/_export")){
return null;
}
else {
if (parseResult.toFieldMapping() != null) {
return channel -> channel.sendResponse(new BytesRestResponse(RestStatus.OK, builder.value(nodeClient.admin().indices().getFieldMappings(parseResult.toFieldMapping()).actionGet())));
Expand All @@ -70,8 +68,10 @@ else if(restRequest.path().endsWith("/_export")){
return channel -> channel.sendResponse(new BytesRestResponse(RestStatus.OK, builder.value(nodeClient.search(parseResult.toRequest()).actionGet())));
}
}
} catch (ElasticSql2DslException e) {
} catch (Exception e) {
return channel -> channel.sendResponse(new BytesRestResponse(RestStatus.INTERNAL_SERVER_ERROR, XContentType.JSON.mediaType(), "{\"error\":\"" + e.getMessage() + "\"}"));
}
}


}

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/resources/plugin-security.policy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
grant {
// needed because of the hot reload functionality
permission java.lang.RuntimePermission "accessDeclaredMembers";
permission java.net.SocketPermission "*", "connect,resolve";
};

0 comments on commit 8f84339

Please sign in to comment.