@@ -758,7 +758,8 @@ Since the \`\`\`Aggregations\`\`\` structure is just a Map Text Aggregation, M.i
758758
759759#### Extracting aggregations from results
760760
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`
762763
763764``` {.haskell}
764765-- Lift decode and response body to be in the IO monad.
@@ -774,7 +775,7 @@ terms
774775Just (Bucket {buckets = [TermsResult {termKey = "bitemyapp", termsDocCount = 1, termsAggs = Nothing}]})
775776```
776777
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`:
778779
779780``` {.haskell}
780781class BucketAggregation a where
@@ -783,9 +784,10 @@ class BucketAggregation a where
783784 aggs :: a -> Maybe AggregationResults
784785```
785786
786−haskell
787−
788−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
787+You can use the `aggs` function to get any nested results, if there
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"`
789791
790792#### Terms Aggregation
791793
@@ -803,7 +805,8 @@ data TermsAggregation
803805 termAggs :: Maybe Aggregations}
804806```
805807
806−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:
807810
808811``` {.haskell}
809812let ta = TermsAgg $ mkTermsAggregation "user"
@@ -833,17 +836,15 @@ data DateHistogramAggregation
833836 dateAggs :: Maybe Aggregations}
834837```
835838
836−haskell
837−
838839The Date Histogram Aggregation works much the same as the Terms Aggregation.
839840
840−Relevant functions include , and
841+Relevant functions include `mkDateHistogram`, and `toDateHistogram`
841842
842843``` {.haskell}
843844let dh = DateHistogramAgg (mkDateHistogram (FieldName "postDate") Minute)
844845```
845846
846−Date histograms also accept a :
847+Date histograms also accept a `FractionalInterval`:
847848
848849``` {.haskell}
849850FractionalInterval :: Float -> TimeInterval -> Interval
@@ -857,7 +858,7 @@ It can be used as follows:
857858let dh = DateHistogramAgg (mkDateHistogram (FieldName "postDate") (FractionalInterval 1.5 Minutes))
858859```
859860
860−The is defined as:
861+The `DateHistogramResult` is defined as:
861862
862863``` {.haskell}
863864data DateHistogramResult
@@ -867,9 +868,10 @@ data DateHistogramResult
867868 dateHistogramAggs :: Maybe AggregationResults}
868869```
869870
870−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.
871872
872−Buckets can be extracted from a using
873+Buckets can be extracted from an `AggregationResult` using
874+`toDateHistogram name`
873875
874876For more information on the Date Histogram Aggregation, see: <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-datehistogram-aggregation.html>
875877