File tree 2 files changed +10
-1
lines changed
main/java/org/elasticsearch/index/reindex
test/java/org/elasticsearch/index/reindex
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 38
38
import java .io .IOException ;
39
39
40
40
import static org .elasticsearch .action .ValidateActions .addValidationError ;
41
- import static org .elasticsearch .index .VersionType .EXTERNAL ;
42
41
import static org .elasticsearch .index .VersionType .INTERNAL ;
43
42
44
43
/**
Original file line number Diff line number Diff line change 21
21
22
22
import org .elasticsearch .action .ActionRequestValidationException ;
23
23
import org .elasticsearch .common .bytes .BytesArray ;
24
+ import org .elasticsearch .index .VersionType ;
24
25
import org .elasticsearch .search .slice .SliceBuilder ;
25
26
26
27
import static java .util .Collections .emptyMap ;
27
28
import static org .elasticsearch .common .unit .TimeValue .parseTimeValue ;
28
29
import static org .elasticsearch .index .query .QueryBuilders .matchAllQuery ;
30
+ import static org .hamcrest .CoreMatchers .is ;
29
31
30
32
/**
31
33
* Tests some of the validation of {@linkplain ReindexRequest}. See reindex's rest tests for much more.
@@ -65,6 +67,14 @@ public void testNoSliceBuilderSetWithSlicedRequest() {
65
67
assertEquals ("Validation Failed: 1: can't specify both manual and automatic slicing at the same time;" , e .getMessage ());
66
68
}
67
69
70
+ public void testReindexShouldThrowErrorWhenCreateIsUsedWithCreate () {
71
+ ReindexRequest reindex = newRequest ();
72
+ reindex .setDestOpType ("create" );
73
+ reindex .setDestVersionType (VersionType .EXTERNAL );
74
+ ActionRequestValidationException e = reindex .validate ();
75
+ assertThat (e .getMessage (), is ("Validation Failed: 1: create operations only support internal versioning. use index instead;" ));
76
+ }
77
+
68
78
@ Override
69
79
protected void extraRandomizationForSlice (ReindexRequest original ) {
70
80
if (randomBoolean ()) {
You can’t perform that action at this time.
0 commit comments