Remove support for the include/pattern syntax. (#23141)

Relates #22933
This commit is contained in:
Adrien Grand 2017-03-01 10:00:38 +01:00 committed by GitHub
parent fd991f32f9
commit b388389ada
3 changed files with 54 additions and 6 deletions

View File

@ -61,7 +61,6 @@ import java.util.TreeSet;
public class IncludeExclude implements Writeable, ToXContent {
public static final ParseField INCLUDE_FIELD = new ParseField("include");
public static final ParseField EXCLUDE_FIELD = new ParseField("exclude");
public static final ParseField PATTERN_FIELD = new ParseField("pattern");
public static final ParseField PARTITION_FIELD = new ParseField("partition");
public static final ParseField NUM_PARTITIONS_FIELD = new ParseField("num_partitions");
// Needed to add this seed for a deterministic term hashing policy
@ -106,11 +105,6 @@ public class IncludeExclude implements Writeable, ToXContent {
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else
// This "include":{"pattern":"foo.*"} syntax is undocumented since 2.0
// Regexes should be "include":"foo.*"
if (PATTERN_FIELD.match(currentFieldName)) {
return new IncludeExclude(parser.text(), null);
} else if (NUM_PARTITIONS_FIELD.match(currentFieldName)) {
numPartitions = parser.intValue();
} else if (PARTITION_FIELD.match(currentFieldName)) {

View File

@ -28,6 +28,7 @@ way to reindex old indices is to use the `reindex` API.
* <<breaking_60_stats_changes>>
* <<breaking_60_rest_changes>>
* <<breaking_60_search_changes>>
* <<breaking_60_aggregations_changes>>
* <<breaking_60_mappings_changes>>
* <<breaking_60_docs_changes>>
* <<breaking_60_cluster_changes>>
@ -47,6 +48,8 @@ include::migrate_6_0/rest.asciidoc[]
include::migrate_6_0/search.asciidoc[]
include::migrate_6_0/aggregations.asciidoc[]
include::migrate_6_0/mappings.asciidoc[]
include::migrate_6_0/docs.asciidoc[]

View File

@ -0,0 +1,51 @@
[[breaking_60_aggregations_changes]]
=== Aggregations changes
==== Deprecated `pattern` element of include/exclude for terms aggregations has been removed
The `include` and `exclude` options of `terms` aggregations used to accept a
sub `pattern` object which has been removed. The pattern should now be directly
put as a value of the `include` and `exclude` fields. For instance, the below
`terms` aggregation:
[source,js]
--------------------------------------------------
POST /twitter/_search?size=0
{
"aggs" : {
"top_users" : {
"terms" : {
"field" : "user",
"include": {
"pattern": "foo.*"
},
"exclude": {
"pattern": ".*bar"
}
}
}
}
}
--------------------------------------------------
// CONSOLE
// TEST[skip: uses old unsupported syntax]
should be replaced with:
[source,js]
--------------------------------------------------
POST /twitter/_search?size=0
{
"aggs" : {
"top_users" : {
"terms" : {
"field" : "user",
"include": "foo.*",
"exclude": ".*bar"
}
}
}
}
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]