Skip to content

Commit

Permalink
Can't create anomaly detector that uses "_index" as "partition_field_…
Browse files Browse the repository at this point in the history
…name" #39406
  • Loading branch information
yana2301 committed Apr 10, 2019
1 parent 5a44cab commit e1a610d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
package org.elasticsearch.xpack.core.ml.job.results;

import org.elasticsearch.index.get.GetResult;
import org.elasticsearch.xpack.core.ml.datafeed.ChunkingConfig;
import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig;
import org.elasticsearch.xpack.core.ml.datafeed.DelayedDataCheckConfig;
Expand Down Expand Up @@ -171,8 +172,11 @@ public final class ReservedFieldNames {

Result.RESULT_TYPE.getPreferredName(),
Result.TIMESTAMP.getPreferredName(),
Result.IS_INTERIM.getPreferredName()
};
Result.IS_INTERIM.getPreferredName(),
GetResult._ID,
GetResult._INDEX,
GetResult._TYPE
};

/**
* This array should be updated to contain all the field names that appear
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
package org.elasticsearch.xpack.ml.job.results;

import org.elasticsearch.index.get.GetResult;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.core.ml.job.results.AnomalyRecord;
import org.elasticsearch.xpack.core.ml.job.results.ReservedFieldNames;
Expand All @@ -16,5 +17,8 @@ public void testIsValidFieldName() {
assertTrue(ReservedFieldNames.isValidFieldName("host.actual"));
assertFalse(ReservedFieldNames.isValidFieldName("actual.host"));
assertFalse(ReservedFieldNames.isValidFieldName(AnomalyRecord.BUCKET_SPAN.getPreferredName()));
assertFalse(ReservedFieldNames.isValidFieldName(GetResult._INDEX));
assertFalse(ReservedFieldNames.isValidFieldName(GetResult._TYPE));
assertFalse(ReservedFieldNames.isValidFieldName(GetResult._ID));
}
}
}

0 comments on commit e1a610d

Please sign in to comment.