HLRC: Fixing bug when getting a missing pipeline (#34286)

closes #34119
This commit is contained in:
Benjamin Trent 2018-10-06 07:25:15 -07:00 committed by GitHub
parent 06993e0c35
commit 6f32f7138d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -29,6 +29,7 @@ import org.elasticsearch.action.ingest.SimulatePipelineResponse;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import java.io.IOException;
import java.util.Collections;
import static java.util.Collections.emptySet;
@ -83,7 +84,7 @@ public final class IngestClient {
*/
public GetPipelineResponse getPipeline(GetPipelineRequest request, RequestOptions options) throws IOException {
return restHighLevelClient.performRequestAndParseEntity( request, IngestRequestConverters::getPipeline, options,
GetPipelineResponse::fromXContent, emptySet());
GetPipelineResponse::fromXContent, Collections.singleton(404));
}
/**
@ -96,7 +97,7 @@ public final class IngestClient {
*/
public void getPipelineAsync(GetPipelineRequest request, RequestOptions options, ActionListener<GetPipelineResponse> listener) {
restHighLevelClient.performRequestAsyncAndParseEntity( request, IngestRequestConverters::getPipeline, options,
GetPipelineResponse::fromXContent, listener, emptySet());
GetPipelineResponse::fromXContent, listener, Collections.singleton(404));
}
/**

View File

@ -78,6 +78,16 @@ public class IngestClientIT extends ESRestHighLevelClientTestCase {
assertEquals(expectedConfig.getConfigAsMap(), response.pipelines().get(0).getConfigAsMap());
}
public void testGetNonexistentPipeline() throws IOException {
String id = "nonexistent_pipeline_id";
GetPipelineRequest request = new GetPipelineRequest(id);
GetPipelineResponse response =
execute(request, highLevelClient().ingest()::getPipeline, highLevelClient().ingest()::getPipelineAsync);
assertFalse(response.isFound());
}
public void testDeletePipeline() throws IOException {
String id = "some_pipeline_id";
{