Skip to content

Commit fe5a35b

Browse files
committed
Merge branch 'master' into pr-10624
Conflicts: src/main/java/org/elasticsearch/index/shard/IndexShard.java
2 parents 7673092 + e28ad85 commit fe5a35b

File tree

306 files changed

+3711
-4849
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

306 files changed

+3711
-4849
lines changed

docs/community/clients.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ See the {client}/perl-api/current/index.html[official Elasticsearch Perl client]
1313
See the {client}/python-api/current/index.html[official Elasticsearch Python client].
1414

1515
* http://github.com/elasticsearch/elasticsearch-dsl-py[elasticsearch-dsl-py]
16-
chainable query and filter construction built on top of offical client.
16+
chainable query and filter construction built on top of official client.
1717

1818
* http://github.com/rhec/pyelasticsearch[pyelasticsearch]:
1919
Python client.

docs/java-api/client.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ be "two hop" operations).
134134
--------------------------------------------------
135135
// on startup
136136
137-
Client client = new TransportClient()
137+
Client client = TransportClient.builder().build()
138138
.addTransportAddress(new InetSocketTransportAddress("host1", 9300))
139139
.addTransportAddress(new InetSocketTransportAddress("host2", 9300));
140140
@@ -150,7 +150,7 @@ Note that you have to set the cluster name if you use one different than
150150
--------------------------------------------------
151151
Settings settings = ImmutableSettings.settingsBuilder()
152152
.put("cluster.name", "myClusterName").build();
153-
Client client = new TransportClient(settings);
153+
Client client = TransportClient.builder().settings(settings).build();
154154
//Add transport addresses and do something with the client...
155155
--------------------------------------------------
156156

@@ -166,7 +166,7 @@ used will be the ones that the other nodes were started with (the
166166
--------------------------------------------------
167167
Settings settings = ImmutableSettings.settingsBuilder()
168168
.put("client.transport.sniff", true).build();
169-
TransportClient client = new TransportClient(settings);
169+
TransportClient client = TransportClient.builder().settings(settings).build();
170170
--------------------------------------------------
171171

172172
Other transport client level settings include:

docs/java-api/query-dsl-filters.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ FilterBuilder filter = geoDistanceFilter("pin.location") <1>
150150
<2> center point
151151
<3> distance from center point
152152
<4> optimize bounding box: `memory`, `indexed` or `none`
153-
<5> distance computation mode: `GeoDistance.SLOPPY_ARC` (default), `GeoDistance.ARC` (slighly more precise but
153+
<5> distance computation mode: `GeoDistance.SLOPPY_ARC` (default), `GeoDistance.ARC` (slightly more precise but
154154
significantly slower) or `GeoDistance.PLANE` (faster, but inaccurate on long distances and close to the poles)
155155

156156
Note that you can cache the result using
Lines changed: 12 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[[search-aggregations]]
2-
== Aggregations
2+
= Aggregations
33

4+
[partintro]
5+
--
46
The aggregations framework helps provide aggregated data based on a search query. It is based on simple building blocks
57
called aggregations, that can be composed in order to build complex summaries of the data.
68

@@ -11,16 +13,19 @@ query/filters of the search request).
1113
There are many different types of aggregations, each with its own purpose and output. To better understand these types,
1214
it is often easier to break them into two main families:
1315

14-
_Bucketing_::
16+
<<search-aggregations-bucket, _Bucketing_>>::
1517
A family of aggregations that build buckets, where each bucket is associated with a _key_ and a document
1618
criterion. When the aggregation is executed, all the buckets criteria are evaluated on every document in
1719
the context and when a criterion matches, the document is considered to "fall in" the relevant bucket.
1820
By the end of the aggregation process, we'll end up with a list of buckets - each one with a set of
1921
documents that "belong" to it.
2022

21-
_Metric_::
23+
<<search-aggregations-metrics, _Metric_>>::
2224
Aggregations that keep track and compute metrics over a set of documents.
2325

26+
<<search-aggregations-reducer, _Reducer_>>::
27+
Aggregations that aggregate the output of other aggregations and their associated metrics
28+
2429
The interesting part comes next. Since each bucket effectively defines a document set (all documents belonging to
2530
the bucket), one can potentially associate aggregations on the bucket level, and those will execute within the context
2631
of that bucket. This is where the real power of aggregations kicks in: *aggregations can be nested!*
@@ -31,7 +36,7 @@ NOTE: Bucketing aggregations can have sub-aggregations (bucketing or metric). Th
3136
another higher-level aggregation).
3237

3338
[float]
34-
=== Structuring Aggregations
39+
== Structuring Aggregations
3540

3641
The following snippet captures the basic structure of aggregations:
3742

@@ -62,7 +67,7 @@ bucketing aggregation. For example, if you define a set of aggregations under th
6267
sub-aggregations will be computed for the range buckets that are defined.
6368

6469
[float]
65-
==== Values Source
70+
=== Values Source
6671

6772
Some aggregations work on values extracted from the aggregated documents. Typically, the values will be extracted from
6873
a specific document field which is set using the `field` key for the aggregations. It is also possible to define a
@@ -89,146 +94,12 @@ perform optimizations when dealing with sorted values (for example, with the `mi
8994
sorted, Elasticsearch will skip the iterations over all the values and rely on the first value in the list to be the
9095
minimum value among all other values associated with the same document).
9196

92-
[float]
93-
=== Metrics Aggregations
94-
95-
The aggregations in this family compute metrics based on values extracted in one way or another from the documents that
96-
are being aggregated. The values are typically extracted from the fields of the document (using the field data), but
97-
can also be generated using scripts.
98-
99-
Numeric metrics aggregations are a special type of metrics aggregation which output numeric values. Some aggregations output
100-
a single numeric metric (e.g. `avg`) and are called `single-value numeric metrics aggregation`, others generate multiple
101-
metrics (e.g. `stats`) and are called `multi-value numeric metrics aggregation`. The distinction between single-value and
102-
multi-value numeric metrics aggregations plays a role when these aggregations serve as direct sub-aggregations of some
103-
bucket aggregations (some bucket aggregations enable you to sort the returned buckets based on the numeric metrics in each bucket).
104-
105-
106-
[float]
107-
=== Bucket Aggregations
108-
109-
Bucket aggregations don't calculate metrics over fields like the metrics aggregations do, but instead, they create
110-
buckets of documents. Each bucket is associated with a criterion (depending on the aggregation type) which determines
111-
whether or not a document in the current context "falls" into it. In other words, the buckets effectively define document
112-
sets. In addition to the buckets themselves, the `bucket` aggregations also compute and return the number of documents
113-
that "fell in" to each bucket.
114-
115-
Bucket aggregations, as opposed to `metrics` aggregations, can hold sub-aggregations. These sub-aggregations will be
116-
aggregated for the buckets created by their "parent" bucket aggregation.
117-
118-
There are different bucket aggregators, each with a different "bucketing" strategy. Some define a single bucket, some
119-
define fixed number of multiple buckets, and others dynamically create the buckets during the aggregation process.
120-
121-
[float]
122-
=== Reducer Aggregations
123-
124-
coming[2.0.0]
125-
126-
experimental[]
127-
128-
Reducer aggregations work on the outputs produced from other aggregations rather than from document sets, adding
129-
information to the output tree. There are many different types of reducer, each computing different information from
130-
other aggregations, but these types can broken down into two families:
131-
132-
_Parent_::
133-
A family of reducer aggregations that is provided with the output of its parent aggregation and is able
134-
to compute new buckets or new aggregations to add to existing buckets.
135-
136-
_Sibling_::
137-
Reducer aggregations that are provided with the output of a sibling aggregation and are able to compute a
138-
new aggregation which will be at the same level as the sibling aggregation.
139-
140-
Reducer aggregations can reference the aggregations they need to perform their computation by using the `buckets_paths`
141-
parameter to indicate the paths to the required metrics. The syntax for defining these paths can be found in the
142-
<<search-aggregations-bucket-terms-aggregation-order, terms aggregation order>> section.
143-
144-
?????? SHOULD THE SECTION ABOUT DEFINING AGGREGATION PATHS
145-
BE IN THIS PAGE AND REFERENCED FROM THE TERMS AGGREGATION DOCUMENTATION ???????
146-
147-
Reducer aggregations cannot have sub-aggregations but depending on the type it can reference another reducer in the `buckets_path`
148-
allowing reducers to be chained.
149-
150-
NOTE: Because reducer aggregations only add to the output, when chaining reducer aggregations the output of each reducer will be
151-
included in the final output.
152-
153-
[float]
154-
=== Caching heavy aggregations
155-
156-
Frequently used aggregations (e.g. for display on the home page of a website)
157-
can be cached for faster responses. These cached results are the same results
158-
that would be returned by an uncached aggregation -- you will never get stale
159-
results.
160-
161-
See <<index-modules-shard-query-cache>> for more details.
162-
163-
[float]
164-
=== Returning only aggregation results
165-
166-
There are many occasions when aggregations are required but search hits are not. For these cases the hits can be ignored by
167-
setting `size=0`. For example:
168-
169-
[source,js]
170-
--------------------------------------------------
171-
$ curl -XGET 'http://localhost:9200/twitter/tweet/_search' -d '{
172-
"size": 0,
173-
"aggregations": {
174-
"my_agg": {
175-
"terms": {
176-
"field": "text"
177-
}
178-
}
179-
}
180-
}
181-
'
182-
--------------------------------------------------
183-
184-
Setting `size` to `0` avoids executing the fetch phase of the search making the request more efficient.
185-
186-
[float]
187-
=== Metadata
188-
189-
You can associate a piece of metadata with individual aggregations at request time that will be returned in place
190-
at response time.
191-
192-
Consider this example where we want to associate the color blue with our `terms` aggregation.
193-
194-
[source,js]
195-
--------------------------------------------------
196-
{
197-
...
198-
aggs": {
199-
"titles": {
200-
"terms": {
201-
"field": "title"
202-
},
203-
"meta": {
204-
"color": "blue"
205-
},
206-
}
207-
}
208-
}
209-
--------------------------------------------------
210-
211-
Then that piece of metadata will be returned in place for our `titles` terms aggregation
212-
213-
[source,js]
214-
--------------------------------------------------
215-
{
216-
...
217-
"aggregations": {
218-
"titles": {
219-
"meta": {
220-
"color" : "blue"
221-
},
222-
"buckets": [
223-
]
224-
}
225-
}
226-
}
227-
--------------------------------------------------
97+
--
22898

22999
include::aggregations/metrics.asciidoc[]
230100

231101
include::aggregations/bucket.asciidoc[]
232102

233103
include::aggregations/reducer.asciidoc[]
234104

105+
include::aggregations/misc.asciidoc[]
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[[search-aggregations-bucket]]
2+
== Bucket Aggregations
3+
4+
Bucket aggregations don't calculate metrics over fields like the metrics aggregations do, but instead, they create
5+
buckets of documents. Each bucket is associated with a criterion (depending on the aggregation type) which determines
6+
whether or not a document in the current context "falls" into it. In other words, the buckets effectively define document
7+
sets. In addition to the buckets themselves, the `bucket` aggregations also compute and return the number of documents
8+
that "fell in" to each bucket.
9+
10+
Bucket aggregations, as opposed to `metrics` aggregations, can hold sub-aggregations. These sub-aggregations will be
11+
aggregated for the buckets created by their "parent" bucket aggregation.
12+
13+
There are different bucket aggregators, each with a different "bucketing" strategy. Some define a single bucket, some
14+
define fixed number of multiple buckets, and others dynamically create the buckets during the aggregation process.
15+
16+
include::bucket/children-aggregation.asciidoc[]
17+
18+
include::bucket/datehistogram-aggregation.asciidoc[]
19+
20+
include::bucket/daterange-aggregation.asciidoc[]
21+
22+
include::bucket/filter-aggregation.asciidoc[]
23+
24+
include::bucket/filters-aggregation.asciidoc[]
25+
26+
include::bucket/geodistance-aggregation.asciidoc[]
27+
28+
include::bucket/geohashgrid-aggregation.asciidoc[]
29+
30+
include::bucket/global-aggregation.asciidoc[]
31+
32+
include::bucket/histogram-aggregation.asciidoc[]
33+
34+
include::bucket/iprange-aggregation.asciidoc[]
35+
36+
include::bucket/missing-aggregation.asciidoc[]
37+
38+
include::bucket/nested-aggregation.asciidoc[]
39+
40+
include::bucket/range-aggregation.asciidoc[]
41+
42+
include::bucket/reverse-nested-aggregation.asciidoc[]
43+
44+
include::bucket/sampler-aggregation.asciidoc[]
45+
46+
include::bucket/significantterms-aggregation.asciidoc[]
47+
48+
include::bucket/terms-aggregation.asciidoc[]
49+
File renamed without changes.
File renamed without changes.

docs/reference/search/aggregations/bucket/daterange-aggregation.asciidoc renamed to docs/reference/aggregations/bucket/daterange-aggregation.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
=== Date Range Aggregation
33

44
A range aggregation that is dedicated for date values. The main difference between this aggregation and the normal <<search-aggregations-bucket-range-aggregation,range>> aggregation is that the `from` and `to` values can be expressed in <<date-math,Date Math>> expressions, and it is also possible to specify a date format by which the `from` and `to` response fields will be returned.
5-
Note that this aggregration includes the `from` value and excludes the `to` value for each range.
5+
Note that this aggregation includes the `from` value and excludes the `to` value for each range.
66

77
Example:
88

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)