remove ParseFieldMatcher usages from IngestMetadata

This commit is contained in:
javanna 2017-01-04 15:56:25 +01:00 committed by Luca Cavanna
parent d60e9bddd0
commit 13dcb8ccbe
2 changed files with 4 additions and 6 deletions

View File

@ -24,8 +24,6 @@ import org.elasticsearch.cluster.DiffableUtils;
import org.elasticsearch.cluster.NamedDiff; import org.elasticsearch.cluster.NamedDiff;
import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.common.ParseField; import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.ParseFieldMatcherSupplier;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ObjectParser; import org.elasticsearch.common.xcontent.ObjectParser;
@ -47,7 +45,7 @@ public final class IngestMetadata implements MetaData.Custom {
public static final String TYPE = "ingest"; public static final String TYPE = "ingest";
private static final ParseField PIPELINES_FIELD = new ParseField("pipeline"); private static final ParseField PIPELINES_FIELD = new ParseField("pipeline");
private static final ObjectParser<List<PipelineConfiguration>, ParseFieldMatcherSupplier> INGEST_METADATA_PARSER = new ObjectParser<>( private static final ObjectParser<List<PipelineConfiguration>, Void> INGEST_METADATA_PARSER = new ObjectParser<>(
"ingest_metadata", ArrayList::new); "ingest_metadata", ArrayList::new);
static { static {
@ -95,7 +93,7 @@ public final class IngestMetadata implements MetaData.Custom {
public static IngestMetadata fromXContent(XContentParser parser) throws IOException { public static IngestMetadata fromXContent(XContentParser parser) throws IOException {
Map<String, PipelineConfiguration> pipelines = new HashMap<>(); Map<String, PipelineConfiguration> pipelines = new HashMap<>();
List<PipelineConfiguration> configs = INGEST_METADATA_PARSER.parse(parser, () -> ParseFieldMatcher.STRICT); List<PipelineConfiguration> configs = INGEST_METADATA_PARSER.parse(parser, null);
for (PipelineConfiguration pipeline : configs) { for (PipelineConfiguration pipeline : configs) {
pipelines.put(pipeline.getId(), pipeline); pipelines.put(pipeline.getId(), pipeline);
} }

View File

@ -50,8 +50,8 @@ public final class PipelineConfiguration extends AbstractDiffable<PipelineConfig
}, new ParseField("config"), ObjectParser.ValueType.OBJECT); }, new ParseField("config"), ObjectParser.ValueType.OBJECT);
} }
public static ContextParser<ParseFieldMatcherSupplier, PipelineConfiguration> getParser() { public static ContextParser<Void, PipelineConfiguration> getParser() {
return (p, c) -> PARSER.apply(p ,c).build(); return (parser, context) -> PARSER.apply(parser, null).build();
} }
private static class Builder { private static class Builder {