Change bulk item requests from ActionRequest to DocumentWriteRequest

x-pack changes for elastisearchelastic/elasticsearch#20109

Original commit: elastic/x-pack-elasticsearch@8c12e1e102
This commit is contained in:
Areek Zillur 2016-10-11 23:15:25 -04:00
parent 0300c67726
commit 5d86c04441
2 changed files with 4 additions and 2 deletions

View File

@ -7,6 +7,7 @@ package org.elasticsearch.xpack.monitoring.action;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.DocWriteRequest;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.client.Requests;
@ -90,7 +91,7 @@ public class MonitoringBulkRequest extends ActionRequest<MonitoringBulkRequest>
// instead of duplicating the parsing logic here we use a new BulkRequest instance to parse the content.
BulkRequest bulkRequest = Requests.bulkRequest().add(content, null, defaultType);
for (ActionRequest request : bulkRequest.requests()) {
for (DocWriteRequest request : bulkRequest.requests()) {
if (request instanceof IndexRequest) {
IndexRequest indexRequest = (IndexRequest) request;

View File

@ -13,6 +13,7 @@ import com.squareup.okhttp.mockwebserver.RecordedRequest;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.DocWriteRequest;
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.index.IndexRequest;
@ -638,7 +639,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
private void assertBulkRequest(Buffer requestBody, int numberOfActions) throws Exception {
BulkRequest bulkRequest = Requests.bulkRequest().add(new BytesArray(requestBody.readByteArray()), null, null);
assertThat(bulkRequest.numberOfActions(), equalTo(numberOfActions));
for (ActionRequest actionRequest : bulkRequest.requests()) {
for (DocWriteRequest actionRequest : bulkRequest.requests()) {
assertThat(actionRequest, instanceOf(IndexRequest.class));
}
}