From 5d86c04441ff239101908f442410b6e1a272f5d2 Mon Sep 17 00:00:00 2001 From: Areek Zillur Date: Tue, 11 Oct 2016 23:15:25 -0400 Subject: [PATCH] Change bulk item requests from ActionRequest to DocumentWriteRequest x-pack changes for elastisearchelastic/elasticsearch#20109 Original commit: elastic/x-pack-elasticsearch@8c12e1e102978376ff2c222ac84ca5bc0155186c --- .../xpack/monitoring/action/MonitoringBulkRequest.java | 3 ++- .../xpack/monitoring/exporter/http/HttpExporterIT.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/monitoring/action/MonitoringBulkRequest.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/monitoring/action/MonitoringBulkRequest.java index 673f1f7bb86..f7dd467efb2 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/monitoring/action/MonitoringBulkRequest.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/monitoring/action/MonitoringBulkRequest.java @@ -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 // 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; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java index ff4941b962f..06cdc1c8828 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java @@ -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)); } }