parent
d3bdff6bbf
commit
417ce9396d
|
@ -33,7 +33,6 @@ import java.util.Locale;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
|
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.not;
|
import static org.hamcrest.Matchers.not;
|
||||||
|
@ -128,6 +127,11 @@ public class DatafeedJobsRestIT extends ESRestTestCase {
|
||||||
+ " \"keyword\":{\"type\":\"keyword\"}"
|
+ " \"keyword\":{\"type\":\"keyword\"}"
|
||||||
+ " }"
|
+ " }"
|
||||||
+ " },"
|
+ " },"
|
||||||
|
+ " \"airline_lowercase_rt\": { "
|
||||||
|
+ " \"type\":\"runtime\","
|
||||||
|
+ " \"runtime_type\": \"keyword\","
|
||||||
|
+ " \"script\" : { \"source\": \"emit(params._source.airline.toLowerCase())\" }"
|
||||||
|
+ " },"
|
||||||
+ " \"responsetime\": { \"type\":\"float\"}"
|
+ " \"responsetime\": { \"type\":\"float\"}"
|
||||||
+ " }"
|
+ " }"
|
||||||
+ " }"
|
+ " }"
|
||||||
|
@ -293,6 +297,13 @@ public class DatafeedJobsRestIT extends ESRestTestCase {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testLookbackOnlyWithRuntimeFields() throws Exception {
|
||||||
|
new LookbackOnlyTestHelper("test-lookback-only-with-runtime-fields", "airline-data")
|
||||||
|
.setAirlineVariant("airline_lowercase_rt")
|
||||||
|
.setShouldSucceedProcessing(true)
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
public void testLookbackonlyWithNestedFields() throws Exception {
|
public void testLookbackonlyWithNestedFields() throws Exception {
|
||||||
String jobId = "test-lookback-only-with-nested-fields";
|
String jobId = "test-lookback-only-with-nested-fields";
|
||||||
Request createJobRequest = new Request("PUT", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId);
|
Request createJobRequest = new Request("PUT", MachineLearning.BASE_PATH + "anomaly_detectors/" + jobId);
|
||||||
|
@ -1083,9 +1094,9 @@ public class DatafeedJobsRestIT extends ESRestTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class LookbackOnlyTestHelper {
|
private class LookbackOnlyTestHelper {
|
||||||
private String jobId;
|
private final String jobId;
|
||||||
|
private final String dataIndex;
|
||||||
private String airlineVariant;
|
private String airlineVariant;
|
||||||
private String dataIndex;
|
|
||||||
private String scriptedFields;
|
private String scriptedFields;
|
||||||
private boolean shouldSucceedInput;
|
private boolean shouldSucceedInput;
|
||||||
private boolean shouldSucceedProcessing;
|
private boolean shouldSucceedProcessing;
|
||||||
|
@ -1120,7 +1131,8 @@ public class DatafeedJobsRestIT extends ESRestTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void execute() throws Exception {
|
public void execute() throws Exception {
|
||||||
createJob(jobId, airlineVariant);
|
Response jobResponse = createJob(jobId, airlineVariant);
|
||||||
|
assertThat(jobResponse.getStatusLine().getStatusCode(), equalTo(200));
|
||||||
String datafeedId = "datafeed-" + jobId;
|
String datafeedId = "datafeed-" + jobId;
|
||||||
new DatafeedBuilder(datafeedId, jobId, dataIndex).setScriptedFields(scriptedFields).build();
|
new DatafeedBuilder(datafeedId, jobId, dataIndex).setScriptedFields(scriptedFields).build();
|
||||||
openJob(client(), jobId);
|
openJob(client(), jobId);
|
||||||
|
|
Loading…
Reference in New Issue