Skip to content

Commit 4a3faf1

Browse files
committed
Merge branch 'master' into feature/query-refactoring
Conflicts: core/src/main/java/org/elasticsearch/index/query/NotQueryParser.java core/src/main/java/org/elasticsearch/index/query/TermsQueryBuilder.java
2 parents 3843ae4 + 501a199 commit 4a3faf1

File tree

7 files changed

+24
-51
lines changed

7 files changed

+24
-51
lines changed

core/src/main/java/org/elasticsearch/index/query/NotQueryParser.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ public NotQueryBuilder fromXContent(QueryParseContext parseContext) throws IOExc
6666
// its the filter, and the name is the field
6767
query = parseContext.parseInnerFilterToQueryBuilder(currentFieldName);
6868
}
69-
} else if (token == XContentParser.Token.START_ARRAY) {
70-
queryFound = true;
71-
// its the filter, and the name is the field
72-
query = parseContext.parseInnerFilterToQueryBuilder(currentFieldName);
7369
} else if (token.isValue()) {
7470
if ("_name".equals(currentFieldName)) {
7571
queryName = parser.text();

core/src/main/java/org/elasticsearch/index/query/TermsQueryBuilder.java

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ public class TermsQueryBuilder extends AbstractQueryBuilder<TermsQueryBuilder> {
4040

4141
private Boolean disableCoord;
4242

43-
private String execution;
44-
4543
private String lookupIndex;
4644
private String lookupType;
4745
private String lookupId;
@@ -125,20 +123,6 @@ public TermsQueryBuilder(String name, Iterable values) {
125123
}
126124

127125
/**
128-
* Sets the execution mode for the terms filter. Cane be either "plain", "bool"
129-
* "and". Defaults to "plain".
130-
* @deprecated elasticsearch now makes better decisions on its own
131-
*/
132-
@Deprecated
133-
public TermsQueryBuilder execution(String execution) {
134-
this.execution = execution;
135-
return this;
136-
}
137-
138-
/**
139-
<<<<<<< HEAD
140-
* Sets the index name to lookup the terms from.
141-
=======
142126
* Sets the minimum number of matches across the provided terms. Defaults to <tt>1</tt>.
143127
* @deprecated use [bool] query instead
144128
*/
@@ -159,8 +143,7 @@ public TermsQueryBuilder disableCoord(boolean disableCoord) {
159143
}
160144

161145
/**
162-
* Sets the filter name for the filter that can be used when searching for matched_filters per hit.
163-
>>>>>>> master
146+
* Sets the index name to lookup the terms from.
164147
*/
165148
public TermsQueryBuilder lookupIndex(String lookupIndex) {
166149
this.lookupIndex = lookupIndex;
@@ -214,10 +197,7 @@ public void doXContent(XContentBuilder builder, Params params) throws IOExceptio
214197
} else {
215198
builder.field(name, values);
216199
}
217-
if (execution != null) {
218-
builder.field("execution", execution);
219-
}
220-
200+
221201
if (minimumShouldMatch != null) {
222202
builder.field("minimum_should_match", minimumShouldMatch);
223203
}

core/src/main/java/org/elasticsearch/index/query/TermsQueryParser.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ public class TermsQueryParser extends BaseQueryParserTemp {
5151

5252
private static final ParseField MIN_SHOULD_MATCH_FIELD = new ParseField("min_match", "min_should_match").withAllDeprecated("Use [bool] query instead");
5353
private static final ParseField DISABLE_COORD_FIELD = new ParseField("disable_coord").withAllDeprecated("Use [bool] query instead");
54+
private static final ParseField EXECUTION_FIELD = new ParseField("execution").withAllDeprecated("execution is deprecated and has no effect");
5455
private Client client;
5556

56-
@Deprecated
57-
public static final String EXECUTION_KEY = "execution";
58-
5957
@Inject
6058
public TermsQueryParser() {
6159
}
@@ -141,7 +139,7 @@ public Query parse(QueryShardContext context) throws IOException, QueryParsingEx
141139
throw new QueryParsingException(parseContext, "[terms] query lookup element requires specifying the path");
142140
}
143141
} else if (token.isValue()) {
144-
if (EXECUTION_KEY.equals(currentFieldName)) {
142+
if (parseContext.parseFieldMatcher().match(currentFieldName, EXECUTION_FIELD)) {
145143
// ignore
146144
} else if (parseContext.parseFieldMatcher().match(currentFieldName, MIN_SHOULD_MATCH_FIELD)) {
147145
if (minShouldMatch != null) {

core/src/test/java/org/elasticsearch/indices/template/SimpleIndexTemplateIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ public void testIndexTemplateWithAliases() throws Exception {
344344
.addAlias(new Alias("templated_alias-{index}"))
345345
.addAlias(new Alias("filtered_alias").filter("{\"type\":{\"value\":\"type2\"}}"))
346346
.addAlias(new Alias("complex_filtered_alias")
347-
.filter(QueryBuilders.termsQuery("_type", "typeX", "typeY", "typeZ").execution("bool")))
347+
.filter(QueryBuilders.termsQuery("_type", "typeX", "typeY", "typeZ")))
348348
.get();
349349

350350
assertAcked(prepareCreate("test_index").addMapping("type1").addMapping("type2").addMapping("typeX").addMapping("typeY").addMapping("typeZ"));

core/src/test/java/org/elasticsearch/search/query/SearchQueryIT.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ public void testEmptytermsQuery() throws Exception {
11411141
}
11421142

11431143
@Test
1144-
public void testFieldDatatermsQuery() throws Exception {
1144+
public void testTermsQuery() throws Exception {
11451145
assertAcked(prepareCreate("test").addMapping("type", "str", "type=string", "lng", "type=long", "dbl", "type=double"));
11461146

11471147
indexRandom(true,
@@ -1151,60 +1151,60 @@ public void testFieldDatatermsQuery() throws Exception {
11511151
client().prepareIndex("test", "type", "4").setSource("str", "4", "lng", 4l, "dbl", 4.0d));
11521152

11531153
SearchResponse searchResponse = client().prepareSearch("test")
1154-
.setQuery(filteredQuery(matchAllQuery(), termsQuery("str", "1", "4").execution("fielddata"))).get();
1154+
.setQuery(filteredQuery(matchAllQuery(), termsQuery("str", "1", "4"))).get();
11551155
assertHitCount(searchResponse, 2l);
11561156
assertSearchHits(searchResponse, "1", "4");
11571157

11581158
searchResponse = client().prepareSearch("test")
1159-
.setQuery(filteredQuery(matchAllQuery(), termsQuery("lng", new long[] {2, 3}).execution("fielddata"))).get();
1159+
.setQuery(filteredQuery(matchAllQuery(), termsQuery("lng", new long[] {2, 3}))).get();
11601160
assertHitCount(searchResponse, 2l);
11611161
assertSearchHits(searchResponse, "2", "3");
11621162

11631163
searchResponse = client().prepareSearch("test")
1164-
.setQuery(filteredQuery(matchAllQuery(), termsQuery("dbl", new double[]{2, 3}).execution("fielddata"))).get();
1164+
.setQuery(filteredQuery(matchAllQuery(), termsQuery("dbl", new double[]{2, 3}))).get();
11651165
assertHitCount(searchResponse, 2l);
11661166
assertSearchHits(searchResponse, "2", "3");
11671167

11681168
searchResponse = client().prepareSearch("test")
1169-
.setQuery(filteredQuery(matchAllQuery(), termsQuery("lng", new int[] {1, 3}).execution("fielddata"))).get();
1169+
.setQuery(filteredQuery(matchAllQuery(), termsQuery("lng", new int[] {1, 3}))).get();
11701170
assertHitCount(searchResponse, 2l);
11711171
assertSearchHits(searchResponse, "1", "3");
11721172

11731173
searchResponse = client().prepareSearch("test")
1174-
.setQuery(filteredQuery(matchAllQuery(), termsQuery("dbl", new float[] {2, 4}).execution("fielddata"))).get();
1174+
.setQuery(filteredQuery(matchAllQuery(), termsQuery("dbl", new float[] {2, 4}))).get();
11751175
assertHitCount(searchResponse, 2l);
11761176
assertSearchHits(searchResponse, "2", "4");
11771177

11781178
// test partial matching
11791179
searchResponse = client().prepareSearch("test")
1180-
.setQuery(filteredQuery(matchAllQuery(), termsQuery("str", "2", "5").execution("fielddata"))).get();
1180+
.setQuery(filteredQuery(matchAllQuery(), termsQuery("str", "2", "5"))).get();
11811181
assertNoFailures(searchResponse);
11821182
assertHitCount(searchResponse, 1l);
11831183
assertFirstHit(searchResponse, hasId("2"));
11841184

11851185
searchResponse = client().prepareSearch("test")
1186-
.setQuery(filteredQuery(matchAllQuery(), termsQuery("dbl", new double[] {2, 5}).execution("fielddata"))).get();
1186+
.setQuery(filteredQuery(matchAllQuery(), termsQuery("dbl", new double[] {2, 5}))).get();
11871187
assertNoFailures(searchResponse);
11881188
assertHitCount(searchResponse, 1l);
11891189
assertFirstHit(searchResponse, hasId("2"));
11901190

11911191
searchResponse = client().prepareSearch("test")
1192-
.setQuery(filteredQuery(matchAllQuery(), termsQuery("lng", new long[] {2, 5}).execution("fielddata"))).get();
1192+
.setQuery(filteredQuery(matchAllQuery(), termsQuery("lng", new long[] {2, 5}))).get();
11931193
assertNoFailures(searchResponse);
11941194
assertHitCount(searchResponse, 1l);
11951195
assertFirstHit(searchResponse, hasId("2"));
11961196

11971197
// test valid type, but no matching terms
11981198
searchResponse = client().prepareSearch("test")
1199-
.setQuery(filteredQuery(matchAllQuery(), termsQuery("str", "5", "6").execution("fielddata"))).get();
1199+
.setQuery(filteredQuery(matchAllQuery(), termsQuery("str", "5", "6"))).get();
12001200
assertHitCount(searchResponse, 0l);
12011201

12021202
searchResponse = client().prepareSearch("test")
1203-
.setQuery(filteredQuery(matchAllQuery(), termsQuery("dbl", new double[] {5, 6}).execution("fielddata"))).get();
1203+
.setQuery(filteredQuery(matchAllQuery(), termsQuery("dbl", new double[] {5, 6}))).get();
12041204
assertHitCount(searchResponse, 0l);
12051205

12061206
searchResponse = client().prepareSearch("test")
1207-
.setQuery(filteredQuery(matchAllQuery(), termsQuery("lng", new long[] {5, 6}).execution("fielddata"))).get();
1207+
.setQuery(filteredQuery(matchAllQuery(), termsQuery("lng", new long[] {5, 6}))).get();
12081208
assertHitCount(searchResponse, 0l);
12091209
}
12101210

docs/reference/migration/migrate_2_0/java.asciidoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,7 @@ The following deprecated methods have been removed:
7474
The redundant BytesQueryBuilder has been removed in favour of the
7575
WrapperQueryBuilder internally.
7676

77+
==== TermsQueryBuilder execution removed
78+
79+
The `TermsQueryBuilder#execution` method has been removed as it has no effect, it is ignored by the
80+
corresponding parser.
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Integration tests for smoke testing multi-node IT
2-
#
2+
# If the local machine which is running the test is low on disk space
3+
# We can have one unassigned shard
34
---
45
"cluster health basic test, one index":
56
- do:
@@ -12,15 +13,9 @@
1213

1314
- do:
1415
cluster.health:
15-
wait_for_status: green
16+
wait_for_status: yellow
1617

1718
- is_true: cluster_name
1819
- is_false: timed_out
1920
- gte: { number_of_nodes: 2 }
2021
- gte: { number_of_data_nodes: 2 }
21-
- gt: { active_primary_shards: 0 }
22-
- gt: { active_shards: 0 }
23-
- gte: { relocating_shards: 0 }
24-
- match: { initializing_shards: 0 }
25-
- match: { unassigned_shards: 0 }
26-
- gte: { number_of_pending_tasks: 0 }

0 commit comments

Comments
 (0)