summaryrefslogtreecommitdiff
path: root/core/src/test/java/org/elasticsearch/search/aggregations
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/test/java/org/elasticsearch/search/aggregations')
-rw-r--r--core/src/test/java/org/elasticsearch/search/aggregations/AggregationCollectorTests.java3
-rw-r--r--core/src/test/java/org/elasticsearch/search/aggregations/AggregatorFactoriesTests.java18
-rw-r--r--core/src/test/java/org/elasticsearch/search/aggregations/BaseAggregationTestCase.java6
-rw-r--r--core/src/test/java/org/elasticsearch/search/aggregations/BasePipelineAggregationTestCase.java6
-rw-r--r--core/src/test/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridParserTests.java11
-rw-r--r--core/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificanceHeuristicTests.java43
-rw-r--r--core/src/test/java/org/elasticsearch/search/aggregations/metrics/FiltersTests.java7
-rw-r--r--core/src/test/java/org/elasticsearch/search/aggregations/metrics/TopHitsTests.java2
-rw-r--r--core/src/test/java/org/elasticsearch/search/aggregations/support/IncludeExcludeTests.java7
9 files changed, 40 insertions, 63 deletions
diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/AggregationCollectorTests.java b/core/src/test/java/org/elasticsearch/search/aggregations/AggregationCollectorTests.java
index 936442f16a..4ddab52110 100644
--- a/core/src/test/java/org/elasticsearch/search/aggregations/AggregationCollectorTests.java
+++ b/core/src/test/java/org/elasticsearch/search/aggregations/AggregationCollectorTests.java
@@ -19,7 +19,6 @@
package org.elasticsearch.search.aggregations;
-import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.json.JsonXContent;
import org.elasticsearch.index.IndexService;
@@ -59,7 +58,7 @@ public class AggregationCollectorTests extends ESSingleNodeTestCase {
private boolean needsScores(IndexService index, String agg) throws IOException {
XContentParser aggParser = createParser(JsonXContent.jsonXContent, agg);
- QueryParseContext parseContext = new QueryParseContext(aggParser, ParseFieldMatcher.STRICT);
+ QueryParseContext parseContext = new QueryParseContext(aggParser);
aggParser.nextToken();
SearchContext context = createSearchContext(index);
final AggregatorFactories factories = AggregatorFactories.parseAggregators(parseContext).build(context, null);
diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/AggregatorFactoriesTests.java b/core/src/test/java/org/elasticsearch/search/aggregations/AggregatorFactoriesTests.java
index 2abb4dcebc..2aba0ed59e 100644
--- a/core/src/test/java/org/elasticsearch/search/aggregations/AggregatorFactoriesTests.java
+++ b/core/src/test/java/org/elasticsearch/search/aggregations/AggregatorFactoriesTests.java
@@ -18,7 +18,6 @@
*/
package org.elasticsearch.search.aggregations;
-import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
@@ -47,8 +46,6 @@ public class AggregatorFactoriesTests extends ESTestCase {
private String[] currentTypes;
private NamedXContentRegistry xContentRegistry;
- protected ParseFieldMatcher parseFieldMatcher;
-
@Override
public void setUp() throws Exception {
super.setUp();
@@ -65,10 +62,8 @@ public class AggregatorFactoriesTests extends ESTestCase {
currentTypes[i] = type;
}
xContentRegistry = new NamedXContentRegistry(new SearchModule(settings, false, emptyList()).getNamedXContents());
- parseFieldMatcher = ParseFieldMatcher.STRICT;
}
-
public void testGetAggregatorFactories_returnsUnmodifiableList() {
AggregatorFactories.Builder builder = new AggregatorFactories.Builder().addAggregator(AggregationBuilders.avg("foo"));
List<AggregationBuilder> aggregatorFactories = builder.getAggregatorFactories();
@@ -102,7 +97,7 @@ public class AggregatorFactoriesTests extends ESTestCase {
.endObject()
.endObject();
XContentParser parser = createParser(source);
- QueryParseContext parseContext = new QueryParseContext(parser, parseFieldMatcher);
+ QueryParseContext parseContext = new QueryParseContext(parser);
assertSame(XContentParser.Token.START_OBJECT, parser.nextToken());
Exception e = expectThrows(ParsingException.class, () -> AggregatorFactories.parseAggregators(parseContext));
assertThat(e.toString(), containsString("Found two aggregation type definitions in [in_stock]: [filter] and [terms]"));
@@ -135,7 +130,7 @@ public class AggregatorFactoriesTests extends ESTestCase {
.endObject()
.endObject();
XContentParser parser = createParser(source);
- QueryParseContext parseContext = new QueryParseContext(parser, parseFieldMatcher);
+ QueryParseContext parseContext = new QueryParseContext(parser);
assertSame(XContentParser.Token.START_OBJECT, parser.nextToken());
Exception e = expectThrows(ParsingException.class, () -> AggregatorFactories.parseAggregators(parseContext));
assertThat(e.toString(), containsString("Found two sub aggregation definitions under [by_date]"));
@@ -170,7 +165,7 @@ public class AggregatorFactoriesTests extends ESTestCase {
.endObject()
.endObject();
XContentParser parser = createParser(source);
- QueryParseContext parseContext = new QueryParseContext(parser, parseFieldMatcher);
+ QueryParseContext parseContext = new QueryParseContext(parser);
assertSame(XContentParser.Token.START_OBJECT, parser.nextToken());
Exception e = expectThrows(ParsingException.class, () -> AggregatorFactories.parseAggregators(parseContext));
assertThat(e.toString(), containsString("Invalid aggregation name [" + name + "]"));
@@ -194,7 +189,7 @@ public class AggregatorFactoriesTests extends ESTestCase {
.endObject()
.endObject();
XContentParser parser = createParser(source);
- QueryParseContext parseContext = new QueryParseContext(parser, parseFieldMatcher);
+ QueryParseContext parseContext = new QueryParseContext(parser);
assertSame(XContentParser.Token.START_OBJECT, parser.nextToken());
Exception e = expectThrows(ParsingException.class, () -> AggregatorFactories.parseAggregators(parseContext));
assertThat(e.toString(), containsString("Two sibling aggregations cannot have the same name: [" + name + "]"));
@@ -219,7 +214,7 @@ public class AggregatorFactoriesTests extends ESTestCase {
.endObject()
.endObject();
XContentParser parser = createParser(source);
- QueryParseContext parseContext = new QueryParseContext(parser, parseFieldMatcher);
+ QueryParseContext parseContext = new QueryParseContext(parser);
assertSame(XContentParser.Token.START_OBJECT, parser.nextToken());
Exception e = expectThrows(ParsingException.class, () -> AggregatorFactories.parseAggregators(parseContext));
assertThat(e.toString(), containsString("Expected [START_OBJECT] under [field], but got a [VALUE_STRING] in [cardinality]"));
@@ -244,7 +239,7 @@ public class AggregatorFactoriesTests extends ESTestCase {
.endObject()
.endObject();
XContentParser parser = createParser(source);
- QueryParseContext parseContext = new QueryParseContext(parser, parseFieldMatcher);
+ QueryParseContext parseContext = new QueryParseContext(parser);
assertSame(XContentParser.Token.START_OBJECT, parser.nextToken());
Exception e = expectThrows(ParsingException.class, () -> AggregatorFactories.parseAggregators(parseContext));
assertThat(e.toString(), containsString("Expected [START_OBJECT] under [field], but got a [VALUE_STRING] in [tag_count]"));
@@ -254,5 +249,4 @@ public class AggregatorFactoriesTests extends ESTestCase {
protected NamedXContentRegistry xContentRegistry() {
return xContentRegistry;
}
-
}
diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/BaseAggregationTestCase.java b/core/src/test/java/org/elasticsearch/search/aggregations/BaseAggregationTestCase.java
index 2d4b80932b..162b7bcd1b 100644
--- a/core/src/test/java/org/elasticsearch/search/aggregations/BaseAggregationTestCase.java
+++ b/core/src/test/java/org/elasticsearch/search/aggregations/BaseAggregationTestCase.java
@@ -19,7 +19,6 @@
package org.elasticsearch.search.aggregations;
-import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
@@ -64,8 +63,6 @@ public abstract class BaseAggregationTestCase<AB extends AbstractAggregationBuil
private NamedWriteableRegistry namedWriteableRegistry;
private NamedXContentRegistry xContentRegistry;
- protected ParseFieldMatcher parseFieldMatcher;
-
protected abstract AB createTestAggregatorBuilder();
/**
@@ -91,7 +88,6 @@ public abstract class BaseAggregationTestCase<AB extends AbstractAggregationBuil
String type = randomAsciiOfLengthBetween(1, 10);
currentTypes[i] = type;
}
- parseFieldMatcher = ParseFieldMatcher.STRICT;
}
@Override
@@ -121,7 +117,7 @@ public abstract class BaseAggregationTestCase<AB extends AbstractAggregationBuil
}
protected AggregationBuilder parse(XContentParser parser) throws IOException {
- QueryParseContext parseContext = new QueryParseContext(parser, parseFieldMatcher);
+ QueryParseContext parseContext = new QueryParseContext(parser);
assertSame(XContentParser.Token.START_OBJECT, parser.nextToken());
AggregatorFactories.Builder parsed = AggregatorFactories.parseAggregators(parseContext);
assertThat(parsed.getAggregatorFactories(), hasSize(1));
diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/BasePipelineAggregationTestCase.java b/core/src/test/java/org/elasticsearch/search/aggregations/BasePipelineAggregationTestCase.java
index 9aaa284819..41bbdaae66 100644
--- a/core/src/test/java/org/elasticsearch/search/aggregations/BasePipelineAggregationTestCase.java
+++ b/core/src/test/java/org/elasticsearch/search/aggregations/BasePipelineAggregationTestCase.java
@@ -20,7 +20,6 @@
package org.elasticsearch.search.aggregations;
import org.elasticsearch.cluster.metadata.MetaData;
-import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
@@ -66,8 +65,6 @@ public abstract class BasePipelineAggregationTestCase<AF extends AbstractPipelin
private NamedWriteableRegistry namedWriteableRegistry;
private NamedXContentRegistry xContentRegistry;
- protected ParseFieldMatcher parseFieldMatcher;
-
protected abstract AF createTestAggregatorFactory();
/**
@@ -93,7 +90,6 @@ public abstract class BasePipelineAggregationTestCase<AF extends AbstractPipelin
String type = randomAsciiOfLengthBetween(1, 10);
currentTypes[i] = type;
}
- parseFieldMatcher = ParseFieldMatcher.STRICT;
}
/**
@@ -121,7 +117,7 @@ public abstract class BasePipelineAggregationTestCase<AF extends AbstractPipelin
}
protected PipelineAggregationBuilder parse(XContentParser parser) throws IOException {
- QueryParseContext parseContext = new QueryParseContext(parser, parseFieldMatcher);
+ QueryParseContext parseContext = new QueryParseContext(parser);
assertSame(XContentParser.Token.START_OBJECT, parser.nextToken());
AggregatorFactories.Builder parsed = AggregatorFactories.parseAggregators(parseContext);
assertThat(parsed.getAggregatorFactories(), hasSize(0));
diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridParserTests.java b/core/src/test/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridParserTests.java
index d52cc108d5..873084b3a8 100644
--- a/core/src/test/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridParserTests.java
+++ b/core/src/test/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridParserTests.java
@@ -18,7 +18,6 @@
*/
package org.elasticsearch.search.aggregations.bucket.geogrid;
-import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.json.JsonXContent;
@@ -32,7 +31,7 @@ public class GeoHashGridParserTests extends ESTestCase {
int precision = randomIntBetween(1, 12);
XContentParser stParser = createParser(JsonXContent.jsonXContent,
"{\"field\":\"my_loc\", \"precision\":" + precision + ", \"size\": 500, \"shard_size\": 550}");
- QueryParseContext parseContext = new QueryParseContext(stParser, ParseFieldMatcher.STRICT);
+ QueryParseContext parseContext = new QueryParseContext(stParser);
XContentParser.Token token = stParser.nextToken();
assertSame(XContentParser.Token.START_OBJECT, token);
// can create a factory
@@ -43,7 +42,7 @@ public class GeoHashGridParserTests extends ESTestCase {
int precision = randomIntBetween(1, 12);
XContentParser stParser = createParser(JsonXContent.jsonXContent,
"{\"field\":\"my_loc\", \"precision\":\"" + precision + "\", \"size\": \"500\", \"shard_size\": \"550\"}");
- QueryParseContext parseContext = new QueryParseContext(stParser, ParseFieldMatcher.STRICT);
+ QueryParseContext parseContext = new QueryParseContext(stParser);
XContentParser.Token token = stParser.nextToken();
assertSame(XContentParser.Token.START_OBJECT, token);
// can create a factory
@@ -52,7 +51,7 @@ public class GeoHashGridParserTests extends ESTestCase {
public void testParseErrorOnNonIntPrecision() throws Exception {
XContentParser stParser = createParser(JsonXContent.jsonXContent, "{\"field\":\"my_loc\", \"precision\":\"2.0\"}");
- QueryParseContext parseContext = new QueryParseContext(stParser, ParseFieldMatcher.STRICT);
+ QueryParseContext parseContext = new QueryParseContext(stParser);
XContentParser.Token token = stParser.nextToken();
assertSame(XContentParser.Token.START_OBJECT, token);
try {
@@ -66,7 +65,7 @@ public class GeoHashGridParserTests extends ESTestCase {
public void testParseErrorOnBooleanPrecision() throws Exception {
XContentParser stParser = createParser(JsonXContent.jsonXContent, "{\"field\":\"my_loc\", \"precision\":false}");
- QueryParseContext parseContext = new QueryParseContext(stParser, ParseFieldMatcher.STRICT);
+ QueryParseContext parseContext = new QueryParseContext(stParser);
XContentParser.Token token = stParser.nextToken();
assertSame(XContentParser.Token.START_OBJECT, token);
try {
@@ -79,7 +78,7 @@ public class GeoHashGridParserTests extends ESTestCase {
public void testParseErrorOnPrecisionOutOfRange() throws Exception {
XContentParser stParser = createParser(JsonXContent.jsonXContent, "{\"field\":\"my_loc\", \"precision\":\"13\"}");
- QueryParseContext parseContext = new QueryParseContext(stParser, ParseFieldMatcher.STRICT);
+ QueryParseContext parseContext = new QueryParseContext(stParser);
XContentParser.Token token = stParser.nextToken();
assertSame(XContentParser.Token.START_OBJECT, token);
try {
diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificanceHeuristicTests.java b/core/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificanceHeuristicTests.java
index 0db3fd6aa3..ccc3b2f09a 100644
--- a/core/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificanceHeuristicTests.java
+++ b/core/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificanceHeuristicTests.java
@@ -20,7 +20,6 @@ package org.elasticsearch.search.aggregations.bucket.significant;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.Version;
-import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.io.stream.InputStreamStreamInput;
import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput;
@@ -48,7 +47,6 @@ import org.elasticsearch.search.aggregations.bucket.significant.heuristics.Perce
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic;
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristicParser;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
-import org.elasticsearch.search.internal.SearchContext;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.TestSearchContext;
@@ -219,57 +217,56 @@ public class SignificanceHeuristicTests extends ESTestCase {
public void testBuilderAndParser() throws Exception {
SearchModule searchModule = new SearchModule(Settings.EMPTY, false, emptyList());
ParseFieldRegistry<SignificanceHeuristicParser> heuristicParserMapper = searchModule.getSignificanceHeuristicParserRegistry();
- SearchContext searchContext = new SignificantTermsTestSearchContext();
// test jlh with string
- assertTrue(parseFromString(heuristicParserMapper, searchContext, "\"jlh\":{}") instanceof JLHScore);
+ assertTrue(parseFromString(heuristicParserMapper, "\"jlh\":{}") instanceof JLHScore);
// test gnd with string
- assertTrue(parseFromString(heuristicParserMapper, searchContext, "\"gnd\":{}") instanceof GND);
+ assertTrue(parseFromString(heuristicParserMapper, "\"gnd\":{}") instanceof GND);
// test mutual information with string
boolean includeNegatives = randomBoolean();
boolean backgroundIsSuperset = randomBoolean();
String mutual = "\"mutual_information\":{\"include_negatives\": " + includeNegatives + ", \"background_is_superset\":"
+ backgroundIsSuperset + "}";
assertEquals(new MutualInformation(includeNegatives, backgroundIsSuperset),
- parseFromString(heuristicParserMapper, searchContext, mutual));
+ parseFromString(heuristicParserMapper, mutual));
String chiSquare = "\"chi_square\":{\"include_negatives\": " + includeNegatives + ", \"background_is_superset\":"
+ backgroundIsSuperset + "}";
assertEquals(new ChiSquare(includeNegatives, backgroundIsSuperset),
- parseFromString(heuristicParserMapper, searchContext, chiSquare));
+ parseFromString(heuristicParserMapper, chiSquare));
// test with builders
- assertThat(parseFromBuilder(heuristicParserMapper, searchContext, new JLHScore()), instanceOf(JLHScore.class));
- assertThat(parseFromBuilder(heuristicParserMapper, searchContext, new GND(backgroundIsSuperset)), instanceOf(GND.class));
+ assertThat(parseFromBuilder(heuristicParserMapper, new JLHScore()), instanceOf(JLHScore.class));
+ assertThat(parseFromBuilder(heuristicParserMapper, new GND(backgroundIsSuperset)), instanceOf(GND.class));
assertEquals(new MutualInformation(includeNegatives, backgroundIsSuperset),
- parseFromBuilder(heuristicParserMapper, searchContext, new MutualInformation(includeNegatives, backgroundIsSuperset)));
+ parseFromBuilder(heuristicParserMapper, new MutualInformation(includeNegatives, backgroundIsSuperset)));
assertEquals(new ChiSquare(includeNegatives, backgroundIsSuperset),
- parseFromBuilder(heuristicParserMapper, searchContext, new ChiSquare(includeNegatives, backgroundIsSuperset)));
+ parseFromBuilder(heuristicParserMapper, new ChiSquare(includeNegatives, backgroundIsSuperset)));
// test exceptions
String faultyHeuristicdefinition = "\"mutual_information\":{\"include_negatives\": false, \"some_unknown_field\": false}";
String expectedError = "unknown field [some_unknown_field]";
- checkParseException(heuristicParserMapper, searchContext, faultyHeuristicdefinition, expectedError);
+ checkParseException(heuristicParserMapper, faultyHeuristicdefinition, expectedError);
faultyHeuristicdefinition = "\"chi_square\":{\"unknown_field\": true}";
expectedError = "unknown field [unknown_field]";
- checkParseException(heuristicParserMapper, searchContext, faultyHeuristicdefinition, expectedError);
+ checkParseException(heuristicParserMapper, faultyHeuristicdefinition, expectedError);
faultyHeuristicdefinition = "\"jlh\":{\"unknown_field\": true}";
expectedError = "expected an empty object, but found ";
- checkParseException(heuristicParserMapper, searchContext, faultyHeuristicdefinition, expectedError);
+ checkParseException(heuristicParserMapper, faultyHeuristicdefinition, expectedError);
faultyHeuristicdefinition = "\"gnd\":{\"unknown_field\": true}";
expectedError = "unknown field [unknown_field]";
- checkParseException(heuristicParserMapper, searchContext, faultyHeuristicdefinition, expectedError);
+ checkParseException(heuristicParserMapper, faultyHeuristicdefinition, expectedError);
}
protected void checkParseException(ParseFieldRegistry<SignificanceHeuristicParser> significanceHeuristicParserRegistry,
- SearchContext searchContext, String faultyHeuristicDefinition, String expectedError) throws IOException {
+ String faultyHeuristicDefinition, String expectedError) throws IOException {
try {
XContentParser stParser = createParser(JsonXContent.jsonXContent,
"{\"field\":\"text\", " + faultyHeuristicDefinition + ",\"min_doc_count\":200}");
- QueryParseContext parseContext = new QueryParseContext(stParser, ParseFieldMatcher.STRICT);
+ QueryParseContext parseContext = new QueryParseContext(stParser);
stParser.nextToken();
SignificantTermsAggregationBuilder.getParser(significanceHeuristicParserRegistry).parse("testagg", parseContext);
fail();
@@ -279,19 +276,19 @@ public class SignificanceHeuristicTests extends ESTestCase {
}
protected SignificanceHeuristic parseFromBuilder(ParseFieldRegistry<SignificanceHeuristicParser> significanceHeuristicParserRegistry,
- SearchContext searchContext, SignificanceHeuristic significanceHeuristic) throws IOException {
+ SignificanceHeuristic significanceHeuristic) throws IOException {
SignificantTermsAggregationBuilder stBuilder = significantTerms("testagg");
stBuilder.significanceHeuristic(significanceHeuristic).field("text").minDocCount(200);
XContentBuilder stXContentBuilder = XContentFactory.jsonBuilder();
stBuilder.internalXContent(stXContentBuilder, null);
XContentParser stParser = createParser(JsonXContent.jsonXContent, stXContentBuilder.string());
- return parseSignificanceHeuristic(significanceHeuristicParserRegistry, searchContext, stParser);
+ return parseSignificanceHeuristic(significanceHeuristicParserRegistry, stParser);
}
private SignificanceHeuristic parseSignificanceHeuristic(
- ParseFieldRegistry<SignificanceHeuristicParser> significanceHeuristicParserRegistry, SearchContext searchContext,
+ ParseFieldRegistry<SignificanceHeuristicParser> significanceHeuristicParserRegistry,
XContentParser stParser) throws IOException {
- QueryParseContext parseContext = new QueryParseContext(stParser, ParseFieldMatcher.STRICT);
+ QueryParseContext parseContext = new QueryParseContext(stParser);
stParser.nextToken();
SignificantTermsAggregationBuilder aggregatorFactory =
(SignificantTermsAggregationBuilder) SignificantTermsAggregationBuilder.getParser(
@@ -304,10 +301,10 @@ public class SignificanceHeuristicTests extends ESTestCase {
}
protected SignificanceHeuristic parseFromString(ParseFieldRegistry<SignificanceHeuristicParser> significanceHeuristicParserRegistry,
- SearchContext searchContext, String heuristicString) throws IOException {
+ String heuristicString) throws IOException {
XContentParser stParser = createParser(JsonXContent.jsonXContent,
"{\"field\":\"text\", " + heuristicString + ", \"min_doc_count\":200}");
- return parseSignificanceHeuristic(significanceHeuristicParserRegistry, searchContext, stParser);
+ return parseSignificanceHeuristic(significanceHeuristicParserRegistry, stParser);
}
void testBackgroundAssertions(SignificanceHeuristic heuristicIsSuperset, SignificanceHeuristic heuristicNotSuperset) {
diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/metrics/FiltersTests.java b/core/src/test/java/org/elasticsearch/search/aggregations/metrics/FiltersTests.java
index bf8e742174..226f3aeada 100644
--- a/core/src/test/java/org/elasticsearch/search/aggregations/metrics/FiltersTests.java
+++ b/core/src/test/java/org/elasticsearch/search/aggregations/metrics/FiltersTests.java
@@ -19,7 +19,6 @@
package org.elasticsearch.search.aggregations.metrics;
-import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
@@ -88,7 +87,7 @@ public class FiltersTests extends BaseAggregationTestCase<FiltersAggregationBuil
builder.endObject();
XContentParser parser = createParser(shuffleXContent(builder));
parser.nextToken();
- QueryParseContext context = new QueryParseContext(parser, ParseFieldMatcher.STRICT);
+ QueryParseContext context = new QueryParseContext(parser);
FiltersAggregationBuilder filters = FiltersAggregationBuilder.parse("agg_name", context);
// The other bucket is disabled by default
assertFalse(filters.otherBucket());
@@ -100,7 +99,7 @@ public class FiltersTests extends BaseAggregationTestCase<FiltersAggregationBuil
builder.endObject();
parser = createParser(shuffleXContent(builder));
parser.nextToken();
- context = new QueryParseContext(parser, ParseFieldMatcher.STRICT);
+ context = new QueryParseContext(parser);
filters = FiltersAggregationBuilder.parse("agg_name", context);
// but setting a key enables it automatically
assertTrue(filters.otherBucket());
@@ -113,7 +112,7 @@ public class FiltersTests extends BaseAggregationTestCase<FiltersAggregationBuil
builder.endObject();
parser = createParser(shuffleXContent(builder));
parser.nextToken();
- context = new QueryParseContext(parser, ParseFieldMatcher.STRICT);
+ context = new QueryParseContext(parser);
filters = FiltersAggregationBuilder.parse("agg_name", context);
// unless the other bucket is explicitly disabled
assertFalse(filters.otherBucket());
diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/metrics/TopHitsTests.java b/core/src/test/java/org/elasticsearch/search/aggregations/metrics/TopHitsTests.java
index bec9ebc633..55fe1b44b7 100644
--- a/core/src/test/java/org/elasticsearch/search/aggregations/metrics/TopHitsTests.java
+++ b/core/src/test/java/org/elasticsearch/search/aggregations/metrics/TopHitsTests.java
@@ -187,7 +187,7 @@ public class TopHitsTests extends BaseAggregationTestCase<TopHitsAggregationBuil
" }\n" +
"}";
XContentParser parser = createParser(JsonXContent.jsonXContent, source);
- QueryParseContext parseContext = new QueryParseContext(parser, parseFieldMatcher);
+ QueryParseContext parseContext = new QueryParseContext(parser);
assertSame(XContentParser.Token.START_OBJECT, parser.nextToken());
Exception e = expectThrows(AggregationInitializationException.class, () -> AggregatorFactories.parseAggregators(parseContext));
assertThat(e.toString(), containsString("Aggregator [top_tags_hits] of type [top_hits] cannot accept sub-aggregations"));
diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/support/IncludeExcludeTests.java b/core/src/test/java/org/elasticsearch/search/aggregations/support/IncludeExcludeTests.java
index 1f4570b8b2..42f0df4beb 100644
--- a/core/src/test/java/org/elasticsearch/search/aggregations/support/IncludeExcludeTests.java
+++ b/core/src/test/java/org/elasticsearch/search/aggregations/support/IncludeExcludeTests.java
@@ -25,7 +25,6 @@ import org.apache.lucene.index.SortedSetDocValues;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LongBitSet;
import org.elasticsearch.common.ParseField;
-import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
@@ -42,8 +41,6 @@ import java.util.Collections;
import java.util.TreeSet;
public class IncludeExcludeTests extends ESTestCase {
- private final ParseFieldMatcher parseFieldMatcher = ParseFieldMatcher.STRICT;
-
public void testEmptyTermsWithOrds() throws IOException {
IncludeExclude inexcl = new IncludeExclude(
new TreeSet<>(Collections.singleton(new BytesRef("foo"))),
@@ -234,7 +231,7 @@ public class IncludeExcludeTests extends ESTestCase {
assertEquals(field.getPreferredName(), parser.currentName());
token = parser.nextToken();
- QueryParseContext parseContext = new QueryParseContext(parser, ParseFieldMatcher.STRICT);
+ QueryParseContext parseContext = new QueryParseContext(parser);
if (field.getPreferredName().equalsIgnoreCase("include")) {
return IncludeExclude.parseInclude(parser, parseContext);
} else if (field.getPreferredName().equalsIgnoreCase("exclude")) {
@@ -274,7 +271,7 @@ public class IncludeExcludeTests extends ESTestCase {
builder.endObject();
XContentParser parser = createParser(builder);
- QueryParseContext parseContext = new QueryParseContext(parser, parseFieldMatcher);
+ QueryParseContext parseContext = new QueryParseContext(parser);
XContentParser.Token token = parser.nextToken();
assertEquals(token, XContentParser.Token.START_OBJECT);