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

This commit is contained in:
Julie Tibshirani 2018-12-19 11:25:45 -08:00 committed by GitHub
parent c85c16bd94
commit 5185d61ad1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 9 deletions

View File

@ -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();

View File

@ -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();

View File

@ -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;
}
}
}