From 1d33fb8b8b2a89622adc9eca20786dc59be4b5e6 Mon Sep 17 00:00:00 2001 From: Dimitrios Athanasiou Date: Mon, 12 Jun 2017 15:49:18 +0100 Subject: [PATCH] [TEST] Add now required mapping for data index in datafeed test Original commit: elastic/x-pack-elasticsearch@67cf68c5a02e66ab8a6bddfc532188fa6a02b517 --- .../license/MachineLearningLicensingTests.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugin/src/test/java/org/elasticsearch/license/MachineLearningLicensingTests.java b/plugin/src/test/java/org/elasticsearch/license/MachineLearningLicensingTests.java index 1bc1cca353e..cfbc1565cdb 100644 --- a/plugin/src/test/java/org/elasticsearch/license/MachineLearningLicensingTests.java +++ b/plugin/src/test/java/org/elasticsearch/license/MachineLearningLicensingTests.java @@ -10,6 +10,7 @@ import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.client.transport.TransportClient; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.common.unit.TimeValue; +import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.license.License.OperationMode; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.test.junit.annotations.TestLogging; @@ -184,7 +185,8 @@ public class MachineLearningLicensingTests extends BaseMlIntegTestCase { String datafeedId = jobId + "-datafeed"; assertMLAllowed(true); String datafeedIndex = jobId + "-data"; - createIndex(datafeedIndex); + prepareCreate(datafeedIndex).addMapping("type", "{\"type\":{\"properties\":{\"time\":{\"type\":\"date\"}}}}", XContentType.JSON) + .get(); try (TransportClient client = new TestXPackTransportClient(internalCluster().transportClient().settings())) { client.addTransportAddress(internalCluster().getDataNodeInstance(Transport.class).boundAddress().publishAddress()); // put job @@ -284,7 +286,8 @@ public class MachineLearningLicensingTests extends BaseMlIntegTestCase { String datafeedId = jobId + "-datafeed"; assertMLAllowed(true); String datafeedIndex = jobId + "-data"; - createIndex(datafeedIndex); + prepareCreate(datafeedIndex).addMapping("type", "{\"type\":{\"properties\":{\"time\":{\"type\":\"date\"}}}}", XContentType.JSON) + .get(); // test that license restricted apis do now work try (TransportClient client = new TestXPackTransportClient(internalCluster().transportClient().settings())) { client.addTransportAddress(internalCluster().getDataNodeInstance(Transport.class).boundAddress().publishAddress()); @@ -356,7 +359,8 @@ public class MachineLearningLicensingTests extends BaseMlIntegTestCase { String datafeedId = jobId + "-datafeed"; assertMLAllowed(true); String datafeedIndex = jobId + "-data"; - createIndex(datafeedIndex); + prepareCreate(datafeedIndex).addMapping("type", "{\"type\":{\"properties\":{\"time\":{\"type\":\"date\"}}}}", XContentType.JSON) + .get(); // test that license restricted apis do now work try (TransportClient client = new TestXPackTransportClient(internalCluster().transportClient().settings())) { client.addTransportAddress(internalCluster().getDataNodeInstance(Transport.class).boundAddress().publishAddress());