Add refresh policy to logstash plugin write requests (#62583) (#62665)

This commit is contained in:
William Brafford 2020-09-18 17:44:53 -04:00 committed by GitHub
parent 4a08928c47
commit 8aeab0bec9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.DocWriteResponse.Result; import org.elasticsearch.action.DocWriteResponse.Result;
import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.HandledTransportAction; import org.elasticsearch.action.support.HandledTransportAction;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.tasks.Task; import org.elasticsearch.tasks.Task;
@ -31,6 +32,7 @@ public class TransportDeletePipelineAction extends HandledTransportAction<Delete
client.prepareDelete() client.prepareDelete()
.setIndex(Logstash.LOGSTASH_CONCRETE_INDEX_NAME) .setIndex(Logstash.LOGSTASH_CONCRETE_INDEX_NAME)
.setId(request.id()) .setId(request.id())
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
.execute( .execute(
ActionListener.wrap( ActionListener.wrap(
deleteResponse -> listener.onResponse(new DeletePipelineResponse(deleteResponse.getResult() == Result.DELETED)), deleteResponse -> listener.onResponse(new DeletePipelineResponse(deleteResponse.getResult() == Result.DELETED)),

View File

@ -9,6 +9,7 @@ package org.elasticsearch.xpack.logstash.action;
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.HandledTransportAction; import org.elasticsearch.action.support.HandledTransportAction;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.tasks.Task; import org.elasticsearch.tasks.Task;
@ -31,6 +32,7 @@ public class TransportPutPipelineAction extends HandledTransportAction<PutPipeli
.setIndex(Logstash.LOGSTASH_CONCRETE_INDEX_NAME) .setIndex(Logstash.LOGSTASH_CONCRETE_INDEX_NAME)
.setId(request.id()) .setId(request.id())
.setSource(request.source(), request.xContentType()) .setSource(request.source(), request.xContentType())
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
.execute( .execute(
ActionListener.wrap( ActionListener.wrap(
indexResponse -> listener.onResponse(new PutPipelineResponse(indexResponse.status())), indexResponse -> listener.onResponse(new PutPipelineResponse(indexResponse.status())),

View File

@ -50,7 +50,6 @@ public class LogstashSystemIndexIT extends ESRestTestCase {
); );
} }
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/62413")
public void testPipelineCRUD() throws Exception { public void testPipelineCRUD() throws Exception {
// put pipeline // put pipeline
final String pipelineJson = getPipelineJson(); final String pipelineJson = getPipelineJson();