git.iko.soy/typeable/bloodhound
on master help sign in
Fix mangled by converting tildes in org mode
3e4bea4Michael Xavier
README.md+15−9
@@ -758,7 +758,8 @@ Since the \`\`\`Aggregations\`\`\` structure is just a Map Text Aggregation, M.i
758
758
759#### Extracting aggregations from results
759#### Extracting aggregations from results
760
760
761−Aggregations are part of the reply structure of every search, in the form of
761+Aggregations are part of the reply structure of every search, in the
762+form of `Maybe AggregationResults`
762
763
763``` {.haskell}
764``` {.haskell}
764-- Lift decode and response body to be in the IO monad.
765-- Lift decode and response body to be in the IO monad.
@@ -774,7 +775,7 @@ terms
774Just (Bucket {buckets = [TermsResult {termKey = "bitemyapp", termsDocCount = 1, termsAggs = Nothing}]})
775Just (Bucket {buckets = [TermsResult {termKey = "bitemyapp", termsDocCount = 1, termsAggs = Nothing}]})
775```
776```
776
777
777−Note that bucket aggregation results, such as the TermsResult is a member of the type class :
778+Note that bucket aggregation results, such as the TermsResult is a member of the type class `BucketAggregation`:
778
779
779``` {.haskell}
780``` {.haskell}
780class BucketAggregation a where
781class BucketAggregation a where
@@ -783,7 +784,10 @@ class BucketAggregation a where
783 aggs :: a -> Maybe AggregationResults
784 aggs :: a -> Maybe AggregationResults
784```
785```
785
786
787+You can use the `aggs` function to get any nested results, if there
786−You can use the function to get any nested results, if there were any. For example, if there were a nested terms aggregation keyed to "age" in a TermsResult named , you would call
788+were any. For example, if there were a nested terms aggregation keyed
789+to "age" in a TermsResult named `termresult` , you would call `aggs
790+termresult >>= toTerms "age"`
787
791
788#### Terms Aggregation
792#### Terms Aggregation
789
793
@@ -801,7 +805,8 @@ data TermsAggregation
801 termAggs :: Maybe Aggregations}
805 termAggs :: Maybe Aggregations}
802```
806```
803
807
804−Term Aggregations have two factory functions, , and , and can be used as follows:
808+Term Aggregations have two factory functions, `mkTermsAggregation`, and
809+`mkTermsScriptAggregation`, and can be used as follows:
805
810
806``` {.haskell}
811``` {.haskell}
807let ta = TermsAgg $ mkTermsAggregation "user"
812let ta = TermsAgg $ mkTermsAggregation "user"
@@ -833,13 +838,13 @@ data DateHistogramAggregation
833
838
834The Date Histogram Aggregation works much the same as the Terms Aggregation.
839The Date Histogram Aggregation works much the same as the Terms Aggregation.
835
840
836−Relevant functions include , and
841+Relevant functions include `mkDateHistogram`, and `toDateHistogram`
837
842
838``` {.haskell}
843``` {.haskell}
839let dh = DateHistogramAgg (mkDateHistogram (FieldName "postDate") Minute)
844let dh = DateHistogramAgg (mkDateHistogram (FieldName "postDate") Minute)
840```
845```
841
846
842−Date histograms also accept a :
847+Date histograms also accept a `FractionalInterval`:
843
848
844``` {.haskell}
849``` {.haskell}
845FractionalInterval :: Float -> TimeInterval -> Interval
850FractionalInterval :: Float -> TimeInterval -> Interval
@@ -853,7 +858,7 @@ It can be used as follows:
853let dh = DateHistogramAgg (mkDateHistogram (FieldName "postDate") (FractionalInterval 1.5 Minutes))
858let dh = DateHistogramAgg (mkDateHistogram (FieldName "postDate") (FractionalInterval 1.5 Minutes))
854```
859```
855
860
856−The is defined as:
861+The `DateHistogramResult` is defined as:
857
862
858``` {.haskell}
863``` {.haskell}
859data DateHistogramResult
864data DateHistogramResult
@@ -863,9 +868,10 @@ data DateHistogramResult
863 dateHistogramAggs :: Maybe AggregationResults}
868 dateHistogramAggs :: Maybe AggregationResults}
864```
869```
865
870
866−It is an instance of , and can have nested aggregations in each bucket.
871+It is an instance of `BucketAggregation`, and can have nested aggregations in each bucket.
867
872
868−Buckets can be extracted from a using
873+Buckets can be extracted from an `AggregationResult` using
874+`toDateHistogram name`
869
875
870For more information on the Date Histogram Aggregation, see: <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-datehistogram-aggregation.html>
876For more information on the Date Histogram Aggregation, see: <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-datehistogram-aggregation.html>
871
877