瀏覽代碼

Make sure to use _doc for the type in SQL REST tests. (#36806)

Julie Tibshirani 6 年之前
父節點
當前提交
5185d61ad1

+ 1 - 3
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<XContentBuilder, IOException> 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();

+ 1 - 3
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<XContentBuilder, IOException> 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();

+ 3 - 3
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<XContentBuilder, IOException> 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;
     }
-}
+}