SQL: Reuse a registry meant to be shared (elastic/x-pack-elasticsearch#2838)
The CLI and JDBC were meant to share the same named xcontent registry but the cli action didn't reuse it by mistake. Original commit: elastic/x-pack-elasticsearch@6c9af5a22a
This commit is contained in:
parent
d96317fbca
commit
44dc98385a
|
@ -40,8 +40,6 @@ import java.util.function.Consumer;
|
||||||
import static org.elasticsearch.rest.RestRequest.Method.POST;
|
import static org.elasticsearch.rest.RestRequest.Method.POST;
|
||||||
|
|
||||||
public class RestSqlCliAction extends AbstractSqlProtocolRestAction {
|
public class RestSqlCliAction extends AbstractSqlProtocolRestAction {
|
||||||
private final NamedWriteableRegistry cursorRegistry = new NamedWriteableRegistry(Cursor.getNamedWriteables());
|
|
||||||
|
|
||||||
public RestSqlCliAction(Settings settings, RestController controller) {
|
public RestSqlCliAction(Settings settings, RestController controller) {
|
||||||
super(settings, Proto.INSTANCE);
|
super(settings, Proto.INSTANCE);
|
||||||
controller.registerHandler(POST, "/_sql/cli", this);
|
controller.registerHandler(POST, "/_sql/cli", this);
|
||||||
|
@ -106,7 +104,7 @@ public class RestSqlCliAction extends AbstractSqlProtocolRestAction {
|
||||||
private Consumer<RestChannel> queryPage(Client client, QueryPageRequest request) {
|
private Consumer<RestChannel> queryPage(Client client, QueryPageRequest request) {
|
||||||
Cursor cursor;
|
Cursor cursor;
|
||||||
CliFormatter formatter;
|
CliFormatter formatter;
|
||||||
try (StreamInput in = new NamedWriteableAwareStreamInput(new BytesArray(request.cursor).streamInput(), cursorRegistry)) {
|
try (StreamInput in = new NamedWriteableAwareStreamInput(new BytesArray(request.cursor).streamInput(), CURSOR_REGISTRY)) {
|
||||||
cursor = in.readNamedWriteable(Cursor.class);
|
cursor = in.readNamedWriteable(Cursor.class);
|
||||||
formatter = new CliFormatter(in);
|
formatter = new CliFormatter(in);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
Loading…
Reference in New Issue