Skip to content

Commit 9f40127

Browse files
committed
Nits
1 parent 98f65ac commit 9f40127

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedJobValidator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static void validate(DatafeedConfig datafeedConfig, Job job, NamedXConten
4141
checkValidDelayedDataCheckConfig(bucketSpan, delayedDataCheckConfig);
4242
}
4343

44-
checkTimeFieldIsNotARuntimeField(datafeedConfig, job.getDataDescription().getTimeField());
44+
checkTimeFieldIsNotASearchRuntimeField(datafeedConfig, job.getDataDescription().getTimeField());
4545
}
4646

4747
private static void checkValidDelayedDataCheckConfig(TimeValue bucketSpan, DelayedDataCheckConfig delayedDataCheckConfig) {
@@ -102,7 +102,8 @@ private static void checkFrequencyIsMultipleOfHistogramInterval(DatafeedConfig d
102102
}
103103
}
104104

105-
private static void checkTimeFieldIsNotARuntimeField(DatafeedConfig datafeedConfig, String timeField) {
105+
private static void checkTimeFieldIsNotASearchRuntimeField(DatafeedConfig datafeedConfig, String timeField) {
106+
// check the search RT mappings defined in the datafeed
106107
Map<String, Object> runtimeMappings = datafeedConfig.getRuntimeMappings();
107108
for (Map.Entry<String, Object> entry : runtimeMappings.entrySet()) {
108109
// top level objects are fields

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/job/persistence/ElasticsearchMappingsTests.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.elasticsearch.common.settings.Settings;
2424
import org.elasticsearch.common.util.concurrent.ThreadContext;
2525
import org.elasticsearch.index.get.GetResult;
26+
import org.elasticsearch.search.builder.SearchSourceBuilder;
2627
import org.elasticsearch.test.ESTestCase;
2728
import org.elasticsearch.test.VersionUtils;
2829
import org.elasticsearch.threadpool.ThreadPool;
@@ -67,7 +68,7 @@ public class ElasticsearchMappingsTests extends ESTestCase {
6768

6869
// These are not reserved because they're Elasticsearch keywords, not
6970
// field names
70-
private static List<String> KEYWORDS = Arrays.asList(
71+
private static final List<String> KEYWORDS = Arrays.asList(
7172
ElasticsearchMappings.ANALYZER,
7273
ElasticsearchMappings.COPY_TO,
7374
ElasticsearchMappings.DYNAMIC,
@@ -76,10 +77,10 @@ public class ElasticsearchMappingsTests extends ESTestCase {
7677
ElasticsearchMappings.PROPERTIES,
7778
ElasticsearchMappings.TYPE,
7879
ElasticsearchMappings.WHITESPACE,
79-
"runtime_mappings"
80+
SearchSourceBuilder.RUNTIME_MAPPINGS_FIELD.getPreferredName()
8081
);
8182

82-
private static List<String> INTERNAL_FIELDS = Arrays.asList(
83+
private static final List<String> INTERNAL_FIELDS = Arrays.asList(
8384
GetResult._ID,
8485
GetResult._INDEX
8586
);
@@ -195,6 +196,7 @@ public void testMappingRequiresUpdateNewerMappingVersionMinor() throws IOExcepti
195196
ElasticsearchMappings.mappingRequiresUpdate(cs, indices, VersionUtils.getPreviousMinorVersion()));
196197
}
197198

199+
@SuppressWarnings({"unchecked", "rawtypes"})
198200
public void testAddDocMappingIfMissing() {
199201
ThreadPool threadPool = mock(ThreadPool.class);
200202
when(threadPool.getThreadContext()).thenReturn(new ThreadContext(Settings.EMPTY));

x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ public void testLookbackOnlyRuntimeMapping() throws Exception {
163163
indexDocs(logger, "data-1", numDocs, twoWeeksAgo, oneWeekAgo);
164164

165165
DataDescription.Builder dataDescription = new DataDescription.Builder();
166-
dataDescription.setTimeFormat("yyyy-MM-dd HH:mm:ss");
167166

168167
Detector.Builder d = new Detector.Builder("count", null);
169168
// day_of_week is a runtime field.

0 commit comments

Comments
 (0)