|
@@ -20,6 +20,7 @@
|
|
|
package org.elasticsearch.index.reindex;
|
|
|
|
|
|
import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;
|
|
|
+import org.elasticsearch.action.bulk.byscroll.BulkByScrollResponse;
|
|
|
import org.elasticsearch.common.xcontent.XContentType;
|
|
|
import org.elasticsearch.index.query.QueryBuilder;
|
|
|
|
|
@@ -27,7 +28,10 @@ import static org.elasticsearch.index.query.QueryBuilders.hasParentQuery;
|
|
|
import static org.elasticsearch.index.query.QueryBuilders.idsQuery;
|
|
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
|
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHits;
|
|
|
+import static org.hamcrest.Matchers.containsString;
|
|
|
import static org.hamcrest.Matchers.equalTo;
|
|
|
+import static org.hamcrest.Matchers.hasToString;
|
|
|
+import static org.hamcrest.Matchers.instanceOf;
|
|
|
|
|
|
/**
|
|
|
* Index-by-search tests for parent/child.
|
|
@@ -76,12 +80,11 @@ public class ReindexParentChildTests extends ReindexTestCase {
|
|
|
createParentChildDocs("source");
|
|
|
|
|
|
ReindexRequestBuilder copy = reindex().source("source").destination("dest").filter(findsCity);
|
|
|
- try {
|
|
|
- copy.get();
|
|
|
- fail("Expected exception");
|
|
|
- } catch (IllegalArgumentException e) {
|
|
|
- assertThat(e.getMessage(), equalTo("Can't specify parent if no parent field has been configured"));
|
|
|
- }
|
|
|
+ final BulkByScrollResponse response = copy.get();
|
|
|
+ assertThat(response.getBulkFailures().size(), equalTo(1));
|
|
|
+ final Exception cause = response.getBulkFailures().get(0).getCause();
|
|
|
+ assertThat(cause, instanceOf(IllegalArgumentException.class));
|
|
|
+ assertThat(cause, hasToString(containsString("can't specify parent if no parent field has been configured")));
|
|
|
}
|
|
|
|
|
|
/**
|