From 5185d61ad190e2bebaf05cc8aa98ddfceb2c1309 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Wed, 19 Dec 2018 11:25:45 -0800 Subject: [PATCH] Make sure to use _doc for the type in SQL REST tests. (#36806) --- .../xpack/sql/qa/cli/CliIntegrationTestCase.java | 4 +--- .../xpack/sql/qa/jdbc/JdbcIntegrationTestCase.java | 4 +--- .../elasticsearch/xpack/sql/qa/jdbc/ResultSetTestCase.java | 6 +++--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/cli/CliIntegrationTestCase.java b/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/cli/CliIntegrationTestCase.java index fe717d23a2c..e7a73cd12d5 100644 --- a/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/cli/CliIntegrationTestCase.java +++ b/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/cli/CliIntegrationTestCase.java @@ -10,7 +10,6 @@ import org.elasticsearch.common.CheckedConsumer; import org.elasticsearch.common.Strings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.json.JsonXContent; -import org.elasticsearch.rest.action.document.RestIndexAction; import org.elasticsearch.test.rest.ESRestTestCase; import org.elasticsearch.xpack.sql.qa.cli.EmbeddedCli.SecurityConfig; import org.junit.After; @@ -58,9 +57,8 @@ public abstract class CliIntegrationTestCase extends ESRestTestCase { } protected void index(String index, CheckedConsumer body) throws IOException { - Request request = new Request("PUT", "/" + index + "/doc/1"); + Request request = new Request("PUT", "/" + index + "/_doc/1"); request.addParameter("refresh", "true"); - request.setOptions(expectWarnings(RestIndexAction.TYPES_DEPRECATION_MESSAGE)); XContentBuilder builder = JsonXContent.contentBuilder().startObject(); body.accept(builder); builder.endObject(); diff --git a/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/JdbcIntegrationTestCase.java b/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/JdbcIntegrationTestCase.java index 039c15359eb..7832f7d35d7 100644 --- a/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/JdbcIntegrationTestCase.java +++ b/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/JdbcIntegrationTestCase.java @@ -12,7 +12,6 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.json.JsonXContent; -import org.elasticsearch.rest.action.document.RestIndexAction; import org.elasticsearch.test.rest.ESRestTestCase; import org.elasticsearch.xpack.sql.jdbc.EsDataSource; import org.junit.After; @@ -85,9 +84,8 @@ public abstract class JdbcIntegrationTestCase extends ESRestTestCase { } public static void index(String index, String documentId, CheckedConsumer body) throws IOException { - Request request = new Request("PUT", "/" + index + "/doc/" + documentId); + Request request = new Request("PUT", "/" + index + "/_doc/" + documentId); request.addParameter("refresh", "true"); - request.setOptions(expectWarnings(RestIndexAction.TYPES_DEPRECATION_MESSAGE)); XContentBuilder builder = JsonXContent.contentBuilder().startObject(); body.accept(builder); builder.endObject(); diff --git a/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/ResultSetTestCase.java b/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/ResultSetTestCase.java index 3cb87085258..ea825074b6a 100644 --- a/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/ResultSetTestCase.java +++ b/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/ResultSetTestCase.java @@ -1273,7 +1273,7 @@ public class ResultSetTestCase extends JdbcIntegrationTestCase { createIndex.endObject(); createIndex.startObject("mappings"); { - createIndex.startObject("doc"); + createIndex.startObject("_doc"); { createIndex.startObject("properties"); {} @@ -1287,7 +1287,7 @@ public class ResultSetTestCase extends JdbcIntegrationTestCase { } private void updateMapping(String index, CheckedConsumer body) throws Exception { - Request request = new Request("PUT", "/" + index + "/_mapping/doc"); + Request request = new Request("PUT", "/" + index + "/_mapping/_doc"); XContentBuilder updateMapping = JsonXContent.contentBuilder().startObject(); updateMapping.startObject("properties"); { @@ -1546,4 +1546,4 @@ public class ResultSetTestCase extends JdbcIntegrationTestCase { assertNotNull("The timezone should be specified", connectionProperties.getProperty(JDBC_TIMEZONE)); return connection; } -} \ No newline at end of file +}