updated Java API docs with the changes due to aggregator refactoring

This commit is contained in:
Colin Goodheart-Smithe 2016-02-12 13:54:10 +00:00
parent 86b0777392
commit c3d652030c
8 changed files with 12 additions and 23 deletions

View File

@ -14,10 +14,9 @@ Here is an example on how to create the aggregation request:
--------------------------------------------------
AggregationBuilder aggregation =
AggregationBuilders
.children("agg")
.childType("reseller");
.children("agg", "reseller"); <1>
--------------------------------------------------
1. `"agg"` is the name of the aggregation and `"reseller"` is the child type
===== Use aggregation response
@ -34,4 +33,3 @@ import org.elasticsearch.search.aggregations.bucket.children.Children;
Children agg = sr.getAggregations().get("agg");
agg.getDocCount(); // Doc count
--------------------------------------------------

View File

@ -13,8 +13,7 @@ Here is an example on how to create the aggregation request:
[source,java]
--------------------------------------------------
AggregationBuilders
.filter("agg")
.filter(QueryBuilders.termQuery("gender", "male"));
.filter("agg", QueryBuilders.termQuery("gender", "male"));
--------------------------------------------------
@ -33,4 +32,3 @@ import org.elasticsearch.search.aggregations.bucket.filter.Filter;
Filter agg = sr.getAggregations().get("agg");
agg.getDocCount(); // Doc count
--------------------------------------------------

View File

@ -14,9 +14,8 @@ Here is an example on how to create the aggregation request:
--------------------------------------------------
AggregationBuilder aggregation =
AggregationBuilders
.filters("agg")
.filter("men", QueryBuilders.termQuery("gender", "male"))
.filter("women", QueryBuilders.termQuery("gender", "female"));
.filters("agg", new KeyedFilter("men", QueryBuilders.termQuery("gender", "male")),
new KeyedFilter("women", QueryBuilders.termQuery("gender", "female")));
--------------------------------------------------

View File

@ -14,9 +14,8 @@ Here is an example on how to create the aggregation request:
--------------------------------------------------
AggregationBuilder aggregation =
AggregationBuilders
.geoDistance("agg")
.geoDistance("agg", new GeoPoint(48.84237171118314,2.33320027692004))
.field("address.location")
.point(new GeoPoint(48.84237171118314,2.33320027692004))
.unit(DistanceUnit.KILOMETERS)
.addUnboundedTo(3.0)
.addRange(3.0, 10.0)
@ -57,4 +56,3 @@ key [*-3.0], from [0.0], to [3.0], doc_count [161]
key [3.0-10.0], from [3.0], to [10.0], doc_count [460]
key [10.0-500.0], from [10.0], to [500.0], doc_count [4925]
--------------------------------------------------

View File

@ -13,8 +13,7 @@ Here is an example on how to create the aggregation request:
[source,java]
--------------------------------------------------
AggregationBuilders
.nested("agg")
.path("resellers");
.nested("agg", "resellers");
--------------------------------------------------
@ -33,4 +32,3 @@ import org.elasticsearch.search.aggregations.bucket.nested.Nested;
Nested agg = sr.getAggregations().get("agg");
agg.getDocCount(); // Doc count
--------------------------------------------------

View File

@ -29,9 +29,9 @@ AggregationBuilder aggregation =
.terms("agg").field("gender")
.subAggregation(
AggregationBuilders.topHits("top")
.setExplain(true)
.setSize(1)
.setFrom(10)
.explain(true)
.size(1)
.from(10)
);
--------------------------------------------------
@ -77,4 +77,3 @@ key [female], doc_count [4893]
-> id [AUnzSZzp9k7PKXtq04x8], _source [{"gender":"female",...}]
-> id [AUnzSZ0W9k7PKXtq04yS], _source [{"gender":"female",...}]
--------------------------------------------------

View File

@ -47,7 +47,7 @@ SearchResponse sr = node.client().prepareSearch()
AggregationBuilders.terms("by_country").field("country")
.subAggregation(AggregationBuilders.dateHistogram("by_year")
.field("dateOfBirth")
.interval((DateHistogramInterval.YEAR)
.dateHistogramInterval((DateHistogramInterval.YEAR)
.subAggregation(AggregationBuilders.avg("avg_children").field("children"))
)
)
@ -61,4 +61,3 @@ include::aggregations/metrics.asciidoc[]
=== Bucket aggregations
include::aggregations/bucket.asciidoc[]

View File

@ -111,7 +111,7 @@ SearchResponse sr = node.client().prepareSearch()
.addAggregation(
AggregationBuilders.dateHistogram("agg2")
.field("birth")
.interval(DateHistogramInterval.YEAR)
.dateHistogramInterval(DateHistogramInterval.YEAR)
)
.execute().actionGet();