File tree 4 files changed +94
-2
lines changed
rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation
server/src/main/java/org/elasticsearch/search/aggregations
4 files changed +94
-2
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,13 @@ The following snippet captures the basic structure of aggregations:
67
67
The `aggregations` object (the key `aggs` can also be used) in the JSON holds the aggregations to be computed. Each aggregation
68
68
is associated with a logical name that the user defines (e.g. if the aggregation computes the average price, then it would
69
69
make sense to name it `avg_price`). These logical names will also be used to uniquely identify the aggregations in the
70
- response. Each aggregation has a specific type (`<aggregation_type>` in the above snippet) and is typically the first
70
+ response.
71
+
72
+ Aggregation names can be any alphanumeric character except a left bracket (`[`), right bracket (`]`) or greater-than sign (`>`).
73
+
74
+ deprecated[6.4.0, Periods in aggregations names have been deprecated, and will be removed in `8.0.0`.]
75
+
76
+ Each aggregation has a specific type (`<aggregation_type>` in the above snippet) and is typically the first
71
77
key within the named aggregation body. Each type of aggregation defines its own body, depending on the nature of the
72
78
aggregation (e.g. an `avg` aggregation on a specific field will define the field on which the average will be calculated).
73
79
At the same level of the aggregation type definition, one can optionally define a set of additional aggregations,
Original file line number Diff line number Diff line change @@ -14,4 +14,9 @@ Requests that try to return more than the limit will fail with an exception.
14
14
==== `missing` option of the `composite` aggregation has been removed
15
15
16
16
The `missing` option of the `composite` aggregation, deprecated in 6.x,
17
- has been removed. `missing_bucket` should be used instead.
17
+ has been removed. `missing_bucket` should be used instead.
18
+
19
+ ==== Dots in aggregation names have been deprecated
20
+
21
+ Starting in 6.4.0, dots in aggregation names have been deprecated. Aggregation names that use
22
+ dots will start to throw exceptions in 8.0.0.
Original file line number Diff line number Diff line change
1
+ setup :
2
+ - do :
3
+ indices.create :
4
+ index : test_1
5
+ body :
6
+ settings :
7
+ number_of_replicas : 0
8
+ mappings :
9
+ doc :
10
+ properties :
11
+ int_field :
12
+ type : integer
13
+ double_field :
14
+ type : double
15
+ string_field :
16
+ type : keyword
17
+
18
+ - do :
19
+ bulk :
20
+ refresh : true
21
+ body :
22
+ - index :
23
+ _index : test_1
24
+ _type : doc
25
+ _id : 1
26
+ - int_field : 1
27
+ double_field : 1.0
28
+ string_field : foo
29
+ - index :
30
+ _index : test_1
31
+ _type : doc
32
+ _id : 2
33
+ - int_field : 51
34
+ double_field : 51.0
35
+ string_field : foo
36
+ - index :
37
+ _index : test_1
38
+ _type : doc
39
+ _id : 3
40
+ - int_field : 101
41
+ double_field : 101.0
42
+ string_field : foo
43
+ - index :
44
+ _index : test_1
45
+ _type : doc
46
+ _id : 4
47
+ - int_field : 151
48
+ double_field : 151.0
49
+ string_field : foo
50
+
51
+ ---
52
+ " Dots in agg names " :
53
+
54
+ - skip :
55
+ version : " - 6.3.99"
56
+ reason : this feature was deprecated in 6.4.0
57
+ features : " warnings"
58
+ - do :
59
+ warnings :
60
+ - " Dots in aggregation names are deprecated and will be removed in 8.0"
61
+ search :
62
+ body :
63
+ aggs :
64
+ dots.in.agg.name :
65
+ avg :
66
+ field : int_field
67
+
68
+ - match : { hits.total: 4 }
69
+ - length : { hits.hits: 4 }
70
+ - match :
71
+ aggregations :
72
+ dots.in.agg.name :
73
+ value : 76.0
74
+
75
+
Original file line number Diff line number Diff line change 23
23
import org .elasticsearch .common .io .stream .StreamInput ;
24
24
import org .elasticsearch .common .io .stream .StreamOutput ;
25
25
import org .elasticsearch .common .io .stream .Writeable ;
26
+ import org .elasticsearch .common .logging .DeprecationLogger ;
27
+ import org .elasticsearch .common .logging .ESLoggerFactory ;
26
28
import org .elasticsearch .common .xcontent .ToXContentObject ;
27
29
import org .elasticsearch .common .xcontent .XContentBuilder ;
28
30
import org .elasticsearch .common .xcontent .XContentParser ;
50
52
import java .util .regex .Pattern ;
51
53
52
54
public class AggregatorFactories {
55
+ private static final DeprecationLogger deprecationLogger = new DeprecationLogger (ESLoggerFactory .getLogger ("deprecation" ));
53
56
public static final Pattern VALID_AGG_NAME = Pattern .compile ("[^\\ [\\ ]>]+" );
54
57
55
58
/**
@@ -75,6 +78,9 @@ private static AggregatorFactories.Builder parseAggregators(XContentParser parse
75
78
throw new ParsingException (parser .getTokenLocation (), "Invalid aggregation name [" + aggregationName
76
79
+ "]. Aggregation names must be alpha-numeric and can only contain '_' and '-'" );
77
80
}
81
+ if (aggregationName .contains ("." )) {
82
+ deprecationLogger .deprecated ("Dots in aggregation names are deprecated and will be removed in 8.0" );
83
+ }
78
84
79
85
token = parser .nextToken ();
80
86
if (token != XContentParser .Token .START_OBJECT ) {
You can’t perform that action at this time.
0 commit comments