mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-03 09:29:11 +00:00
update rest status
This commit is contained in:
parent
bce7f6c7ad
commit
1f29fa4fe9
@ -39,7 +39,6 @@ public class IngestModule extends AbstractModule {
|
||||
protected void configure() {
|
||||
binder().bind(IngestRestFilter.class).asEagerSingleton();
|
||||
binder().bind(PipelineExecutionService.class).asEagerSingleton();
|
||||
// TODO(talevy): write it! binder().bind(PipelineSimulateService.class).asEagerSingleton();
|
||||
binder().bind(PipelineStore.class).asEagerSingleton();
|
||||
binder().bind(PipelineStoreClient.class).asEagerSingleton();
|
||||
|
||||
|
@ -23,10 +23,7 @@ import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.xcontent.StatusToXContent;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
||||
import org.elasticsearch.ingest.Data;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -91,6 +88,11 @@ public class SimulatePipelineResponse extends ActionResponse implements StatusTo
|
||||
|
||||
@Override
|
||||
public RestStatus status() {
|
||||
for (SimulatedItemResponse response : responses) {
|
||||
if (response.failed()) {
|
||||
return response.status();
|
||||
}
|
||||
}
|
||||
return RestStatus.OK;
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,11 @@ public class SimulatedItemResponse implements Streamable, StatusToXContent {
|
||||
|
||||
@Override
|
||||
public RestStatus status() {
|
||||
return null;
|
||||
if (failed()) {
|
||||
return RestStatus.BAD_REQUEST;
|
||||
} else {
|
||||
return RestStatus.OK;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user