git.iko.soy/typeable/bloodhound
on master help sign in
Merge pull request #93 from bitemyapp/90-markdown-bugs
c115b89Chris Allen
README.md+15−13
@@ -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,9 +784,10 @@ class BucketAggregation a where
783 aggs :: a -> Maybe AggregationResults
784 aggs :: a -> Maybe AggregationResults
784```
785```
785
786
786−haskell
787+You can use the `aggs` function to get any nested results, if there
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
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"`
789
791
790#### Terms Aggregation
792#### Terms Aggregation
791
793
@@ -803,7 +805,8 @@ data TermsAggregation
803 termAggs :: Maybe Aggregations}
805 termAggs :: Maybe Aggregations}
804```
806```
805
807
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:
807
810
808``` {.haskell}
811``` {.haskell}
809let ta = TermsAgg $ mkTermsAggregation "user"
812let ta = TermsAgg $ mkTermsAggregation "user"
@@ -833,17 +836,15 @@ data DateHistogramAggregation
833 dateAggs :: Maybe Aggregations}
836 dateAggs :: Maybe Aggregations}
834```
837```
835
838
836−haskell
837−
838The Date Histogram Aggregation works much the same as the Terms Aggregation.
839The Date Histogram Aggregation works much the same as the Terms Aggregation.
839
840
840−Relevant functions include , and
841+Relevant functions include `mkDateHistogram`, and `toDateHistogram`
841
842
842``` {.haskell}
843``` {.haskell}
843let dh = DateHistogramAgg (mkDateHistogram (FieldName "postDate") Minute)
844let dh = DateHistogramAgg (mkDateHistogram (FieldName "postDate") Minute)
844```
845```
845
846
846−Date histograms also accept a :
847+Date histograms also accept a `FractionalInterval`:
847
848
848``` {.haskell}
849``` {.haskell}
849FractionalInterval :: Float -> TimeInterval -> Interval
850FractionalInterval :: Float -> TimeInterval -> Interval
@@ -857,7 +858,7 @@ It can be used as follows:
857let dh = DateHistogramAgg (mkDateHistogram (FieldName "postDate") (FractionalInterval 1.5 Minutes))
858let dh = DateHistogramAgg (mkDateHistogram (FieldName "postDate") (FractionalInterval 1.5 Minutes))
858```
859```
859
860
860−The is defined as:
861+The `DateHistogramResult` is defined as:
861
862
862``` {.haskell}
863``` {.haskell}
863data DateHistogramResult
864data DateHistogramResult
@@ -867,9 +868,10 @@ data DateHistogramResult
867 dateHistogramAggs :: Maybe AggregationResults}
868 dateHistogramAggs :: Maybe AggregationResults}
868```
869```
869
870
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.
871
872
872−Buckets can be extracted from a using
873+Buckets can be extracted from an `AggregationResult` using
874+`toDateHistogram name`
873
875
874For 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>
875
877