Skip to content

Commit

Permalink
CR: Move default setting value to _none
Browse files Browse the repository at this point in the history
  • Loading branch information
original-brownbear committed Aug 1, 2018
1 parent f005a40 commit b6d3ecb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected void doExecute(Task task, BulkRequest bulkRequest, ActionListener<Bulk
IndexMetaData indexMetaData = indicesMetaData.get(indexRequest.index());
if (indexMetaData != null) {
String defaultPipeline = IndexSettings.DEFAULT_PIPELINE.get(indexMetaData.getSettings());
if (defaultPipeline.isEmpty() == false) {
if (IngestService.NOOP_PIPELINE_NAME.equals(defaultPipeline) == false) {
indexRequest.setPipeline(defaultPipeline);
hasIndexRequestsWithPipelines = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.translog.Translog;
import org.elasticsearch.ingest.IngestService;
import org.elasticsearch.node.Node;

import java.util.Collections;
Expand Down Expand Up @@ -255,7 +256,12 @@ public final class IndexSettings {
1000, 1, Property.Dynamic, Property.IndexScope);

public static final Setting<String> DEFAULT_PIPELINE =
Setting.simpleString("index.default_pipeline", "", Property.Dynamic, Property.IndexScope);
new Setting<>("index.default_pipeline", IngestService.NOOP_PIPELINE_NAME, s -> {
if (s == null || s.isEmpty()) {
throw new IllegalArgumentException("Value for [index.default_pipeline] must be a non-empty string.");
}
return s;
}, Property.Dynamic, Property.IndexScope);

private final Index index;
private final Version version;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.cluster.ClusterChangedEvent;
import org.elasticsearch.cluster.ClusterStateApplier;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.metrics.CounterMetric;
import org.elasticsearch.common.metrics.MeanMetric;
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
Expand Down Expand Up @@ -77,7 +76,7 @@ protected void doRun() throws Exception {
continue;
}
String pipeline = indexRequest.getPipeline();
if (Strings.hasText(pipeline) && IngestService.NOOP_PIPELINE_NAME.equals(pipeline) == false) {
if (IngestService.NOOP_PIPELINE_NAME.equals(pipeline) == false) {
try {
innerExecute(indexRequest, getPipeline(indexRequest.getPipeline()));
//this shouldn't be needed here but we do it for consistency with index api
Expand Down

0 comments on commit b6d3ecb

Please sign in to comment.