From 64c3212fdb43b5a73d21e917fe45eff9cdd57bb7 Mon Sep 17 00:00:00 2001 From: javanna Date: Thu, 12 Jan 2017 11:38:40 +0100 Subject: [PATCH] Remove ParseFieldMatcher usages from IndexSettings --- .../allocation/command/BasePrimaryAllocationCommand.java | 1 - .../main/java/org/elasticsearch/index/IndexSettings.java | 8 -------- .../org/elasticsearch/ingest/PipelineConfiguration.java | 3 +-- .../bucket/histogram/HistogramAggregationBuilder.java | 3 +-- .../src/main/java/org/elasticsearch/tasks/TaskResult.java | 1 - .../script/mustache/RestSearchTemplateAction.java | 2 +- .../index/reindex/AbstractBulkByQueryRestHandler.java | 2 +- 7 files changed, 4 insertions(+), 16 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/cluster/routing/allocation/command/BasePrimaryAllocationCommand.java b/core/src/main/java/org/elasticsearch/cluster/routing/allocation/command/BasePrimaryAllocationCommand.java index bccfd97e534..2cb04260125 100644 --- a/core/src/main/java/org/elasticsearch/cluster/routing/allocation/command/BasePrimaryAllocationCommand.java +++ b/core/src/main/java/org/elasticsearch/cluster/routing/allocation/command/BasePrimaryAllocationCommand.java @@ -20,7 +20,6 @@ package org.elasticsearch.cluster.routing.allocation.command; import org.elasticsearch.common.ParseField; -import org.elasticsearch.common.ParseFieldMatcherSupplier; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ObjectParser; diff --git a/core/src/main/java/org/elasticsearch/index/IndexSettings.java b/core/src/main/java/org/elasticsearch/index/IndexSettings.java index dbe6d3505a4..25751cfc771 100644 --- a/core/src/main/java/org/elasticsearch/index/IndexSettings.java +++ b/core/src/main/java/org/elasticsearch/index/IndexSettings.java @@ -22,7 +22,6 @@ import org.apache.logging.log4j.Logger; import org.apache.lucene.index.MergePolicy; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.ParseFieldMatcher; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.IndexScopedSettings; import org.elasticsearch.common.settings.Setting; @@ -136,7 +135,6 @@ public final class IndexSettings { private final Settings nodeSettings; private final int numberOfShards; private final boolean isShadowReplicaIndex; - private final ParseFieldMatcher parseFieldMatcher; // volatile fields are updated via #updateIndexMetaData(IndexMetaData) under lock private volatile Settings settings; private volatile IndexMetaData indexMetaData; @@ -237,7 +235,6 @@ public final class IndexSettings { this.queryStringLenient = QUERY_STRING_LENIENT_SETTING.get(settings); this.queryStringAnalyzeWildcard = QUERY_STRING_ANALYZE_WILDCARD.get(nodeSettings); this.queryStringAllowLeadingWildcard = QUERY_STRING_ALLOW_LEADING_WILDCARD.get(nodeSettings); - this.parseFieldMatcher = new ParseFieldMatcher(settings); this.defaultAllowUnmappedFields = scopedSettings.get(ALLOW_UNMAPPED); this.durability = scopedSettings.get(INDEX_TRANSLOG_DURABILITY_SETTING); syncInterval = INDEX_TRANSLOG_SYNC_INTERVAL_SETTING.get(settings); @@ -388,11 +385,6 @@ public final class IndexSettings { return nodeSettings; } - /** - * Returns a {@link ParseFieldMatcher} for this index. - */ - public ParseFieldMatcher getParseFieldMatcher() { return parseFieldMatcher; } - /** * Updates the settings and index metadata and notifies all registered settings consumers with the new settings iff at least one setting has changed. * diff --git a/core/src/main/java/org/elasticsearch/ingest/PipelineConfiguration.java b/core/src/main/java/org/elasticsearch/ingest/PipelineConfiguration.java index 543a02d3e86..5cb9f6111f5 100644 --- a/core/src/main/java/org/elasticsearch/ingest/PipelineConfiguration.java +++ b/core/src/main/java/org/elasticsearch/ingest/PipelineConfiguration.java @@ -22,7 +22,6 @@ package org.elasticsearch.ingest; import org.elasticsearch.cluster.AbstractDiffable; import org.elasticsearch.cluster.Diff; import org.elasticsearch.common.ParseField; -import org.elasticsearch.common.ParseFieldMatcherSupplier; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -40,7 +39,7 @@ import java.util.Map; */ public final class PipelineConfiguration extends AbstractDiffable implements ToXContent { - private static final ObjectParser PARSER = new ObjectParser<>("pipeline_config", Builder::new); + private static final ObjectParser PARSER = new ObjectParser<>("pipeline_config", Builder::new); static { PARSER.declareString(Builder::setId, new ParseField("id")); PARSER.declareField((parser, builder, aVoid) -> { diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregationBuilder.java index 00f0f2667e0..87c7404c088 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregationBuilder.java @@ -20,7 +20,6 @@ package org.elasticsearch.search.aggregations.bucket.histogram; import org.elasticsearch.common.ParseField; -import org.elasticsearch.common.ParseFieldMatcherSupplier; import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -51,7 +50,7 @@ public class HistogramAggregationBuilder extends ValuesSourceAggregationBuilder { public static final String NAME = "histogram"; - private static final ObjectParser EXTENDED_BOUNDS_PARSER = new ObjectParser<>( + private static final ObjectParser EXTENDED_BOUNDS_PARSER = new ObjectParser<>( Histogram.EXTENDED_BOUNDS_FIELD.getPreferredName(), () -> new double[]{ Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY }); static { diff --git a/core/src/main/java/org/elasticsearch/tasks/TaskResult.java b/core/src/main/java/org/elasticsearch/tasks/TaskResult.java index 362eb7a4b07..5df43b7485c 100644 --- a/core/src/main/java/org/elasticsearch/tasks/TaskResult.java +++ b/core/src/main/java/org/elasticsearch/tasks/TaskResult.java @@ -22,7 +22,6 @@ import org.elasticsearch.ElasticsearchException; import org.elasticsearch.client.Requests; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.ParseField; -import org.elasticsearch.common.ParseFieldMatcherSupplier; import org.elasticsearch.common.Strings; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.io.stream.StreamInput; diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java index f88ecc981a8..32f6ad6f360 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java @@ -94,7 +94,7 @@ public class RestSearchTemplateAction extends BaseRestHandler { // Creates the search request with all required params SearchRequest searchRequest = new SearchRequest(); - RestSearchAction.parseSearchRequest(searchRequest, request, parseFieldMatcher, null); + RestSearchAction.parseSearchRequest(searchRequest, request, null); // Creates the search template request SearchTemplateRequest searchTemplateRequest; diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByQueryRestHandler.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByQueryRestHandler.java index 1b6b8c74a78..4a786907f71 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByQueryRestHandler.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByQueryRestHandler.java @@ -62,7 +62,7 @@ public abstract class AbstractBulkByQueryRestHandler< * the generated parser probably is a noop but we should do the accounting just in case. It doesn't hurt to close twice but it * really hurts not to close if by some miracle we have to. */ try { - RestSearchAction.parseSearchRequest(searchRequest, restRequest, parseFieldMatcher, searchRequestParser); + RestSearchAction.parseSearchRequest(searchRequest, restRequest, searchRequestParser); } finally { IOUtils.close(searchRequestParser); }