From c3d652030cae3d74a5006eedb2dce1b9c5ce3bd8 Mon Sep 17 00:00:00 2001 From: Colin Goodheart-Smithe Date: Fri, 12 Feb 2016 13:54:10 +0000 Subject: [PATCH] updated Java API docs with the changes due to aggregator refactoring --- .../aggregations/bucket/children-aggregation.asciidoc | 6 ++---- .../aggregations/bucket/filter-aggregation.asciidoc | 4 +--- .../aggregations/bucket/filters-aggregation.asciidoc | 5 ++--- .../aggregations/bucket/geodistance-aggregation.asciidoc | 4 +--- .../aggregations/bucket/nested-aggregation.asciidoc | 4 +--- .../aggregations/metrics/tophits-aggregation.asciidoc | 7 +++---- docs/java-api/aggs.asciidoc | 3 +-- docs/java-api/search.asciidoc | 2 +- 8 files changed, 12 insertions(+), 23 deletions(-) diff --git a/docs/java-api/aggregations/bucket/children-aggregation.asciidoc b/docs/java-api/aggregations/bucket/children-aggregation.asciidoc index aa4fb4523ef..1bf8a5b26e6 100644 --- a/docs/java-api/aggregations/bucket/children-aggregation.asciidoc +++ b/docs/java-api/aggregations/bucket/children-aggregation.asciidoc @@ -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 -------------------------------------------------- - diff --git a/docs/java-api/aggregations/bucket/filter-aggregation.asciidoc b/docs/java-api/aggregations/bucket/filter-aggregation.asciidoc index 8c462ed50bd..3ffb05202bb 100644 --- a/docs/java-api/aggregations/bucket/filter-aggregation.asciidoc +++ b/docs/java-api/aggregations/bucket/filter-aggregation.asciidoc @@ -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 -------------------------------------------------- - diff --git a/docs/java-api/aggregations/bucket/filters-aggregation.asciidoc b/docs/java-api/aggregations/bucket/filters-aggregation.asciidoc index 903fa158679..1734bff6a8a 100644 --- a/docs/java-api/aggregations/bucket/filters-aggregation.asciidoc +++ b/docs/java-api/aggregations/bucket/filters-aggregation.asciidoc @@ -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"))); -------------------------------------------------- diff --git a/docs/java-api/aggregations/bucket/geodistance-aggregation.asciidoc b/docs/java-api/aggregations/bucket/geodistance-aggregation.asciidoc index 9d0ff65fdab..472c3ac59bf 100644 --- a/docs/java-api/aggregations/bucket/geodistance-aggregation.asciidoc +++ b/docs/java-api/aggregations/bucket/geodistance-aggregation.asciidoc @@ -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] -------------------------------------------------- - diff --git a/docs/java-api/aggregations/bucket/nested-aggregation.asciidoc b/docs/java-api/aggregations/bucket/nested-aggregation.asciidoc index bf60e4ae420..b1ebad7a63b 100644 --- a/docs/java-api/aggregations/bucket/nested-aggregation.asciidoc +++ b/docs/java-api/aggregations/bucket/nested-aggregation.asciidoc @@ -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 -------------------------------------------------- - diff --git a/docs/java-api/aggregations/metrics/tophits-aggregation.asciidoc b/docs/java-api/aggregations/metrics/tophits-aggregation.asciidoc index 09c68709c6d..2473b4b89d7 100644 --- a/docs/java-api/aggregations/metrics/tophits-aggregation.asciidoc +++ b/docs/java-api/aggregations/metrics/tophits-aggregation.asciidoc @@ -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",...}] -------------------------------------------------- - diff --git a/docs/java-api/aggs.asciidoc b/docs/java-api/aggs.asciidoc index f6b1b4d79b7..fc53f44497d 100644 --- a/docs/java-api/aggs.asciidoc +++ b/docs/java-api/aggs.asciidoc @@ -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[] - diff --git a/docs/java-api/search.asciidoc b/docs/java-api/search.asciidoc index 27ad0beac1c..c80853c4195 100644 --- a/docs/java-api/search.asciidoc +++ b/docs/java-api/search.asciidoc @@ -111,7 +111,7 @@ SearchResponse sr = node.client().prepareSearch() .addAggregation( AggregationBuilders.dateHistogram("agg2") .field("birth") - .interval(DateHistogramInterval.YEAR) + .dateHistogramInterval(DateHistogramInterval.YEAR) ) .execute().actionGet();