Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ protected ExecuteEnrichPolicyAction.Response read(StreamInput in) throws IOExcep
@Override
protected void masterOperation(Task task, ExecuteEnrichPolicyAction.Request request, ClusterState state,
ActionListener<ExecuteEnrichPolicyAction.Response> listener) {
if (state.getNodes().getIngestNodes().isEmpty()) {
// if we don't fail here then reindex will fail with a more complicated error.
// (EnrichPolicyRunner uses a pipeline with reindex)
throw new IllegalStateException("no ingest nodes in this cluster");
}

if (request.isWaitForCompletion()) {
executor.runPolicy(request, new ActionListener<>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,19 @@ public void testEnrichDedicatedIngestNode() {
enrich(keys, ingestOnlyNode);
}

public void testEnrichNoIngestNodes() {
Settings settings = Settings.builder()
.put(Node.NODE_MASTER_SETTING.getKey(), true)
.put(Node.NODE_DATA_SETTING.getKey(), true)
.put(Node.NODE_INGEST_SETTING.getKey(), false)
.build();
internalCluster().startNode(settings);

createSourceIndex(64);
Exception e = expectThrows(IllegalStateException.class, EnrichMultiNodeIT::createAndExecutePolicy);
assertThat(e.getMessage(), equalTo("no ingest nodes in this cluster"));
}

private static void enrich(List<String> keys, String coordinatingNode) {
int numDocs = 256;
BulkRequest bulkRequest = new BulkRequest("my-index");
Expand Down