Commit a01b08321f0b3113ff922a34b4475d413a40a1ce
1 parent
280bd7df
Exists in
master
and in
19 other branches
Removed facet instructions [skip ci]
Showing
1 changed file
with
0 additions
and
57 deletions
Show diff stats
README.md
@@ -769,63 +769,6 @@ For other aggregation types, including sub-aggregations, use `body_options`: | @@ -769,63 +769,6 @@ For other aggregation types, including sub-aggregations, use `body_options`: | ||
769 | Product.search "orange", body_options: {aggs: {price: {histogram: {field: :price, interval: 10}}} | 769 | Product.search "orange", body_options: {aggs: {price: {histogram: {field: :price, interval: 10}}} |
770 | ``` | 770 | ``` |
771 | 771 | ||
772 | -#### Moving From Facets | ||
773 | - | ||
774 | -1. Replace `facets` with `aggs` in searches. **Note:** Stats facets are not supported at this time. | ||
775 | - | ||
776 | - ```ruby | ||
777 | - products = Product.search "chuck taylor", facets: [:brand] | ||
778 | - # to | ||
779 | - products = Product.search "chuck taylor", aggs: [:brand] | ||
780 | - ``` | ||
781 | - | ||
782 | -2. Replace the `facets` method with `aggs` for results. | ||
783 | - | ||
784 | - ```ruby | ||
785 | - products.facets | ||
786 | - # to | ||
787 | - products.aggs | ||
788 | - ``` | ||
789 | - | ||
790 | - The keys in results differ slightly. Instead of: | ||
791 | - | ||
792 | - ```json | ||
793 | - { | ||
794 | - "_type":"terms", | ||
795 | - "missing":0, | ||
796 | - "total":45, | ||
797 | - "other":34, | ||
798 | - "terms":[ | ||
799 | - {"term":14.0,"count":11} | ||
800 | - ] | ||
801 | - } | ||
802 | - ``` | ||
803 | - | ||
804 | - You get: | ||
805 | - | ||
806 | - ```json | ||
807 | - { | ||
808 | - "doc_count":45, | ||
809 | - "doc_count_error_upper_bound":0, | ||
810 | - "sum_other_doc_count":34, | ||
811 | - "buckets":[ | ||
812 | - {"key":14.0,"doc_count":11} | ||
813 | - ] | ||
814 | - } | ||
815 | - ``` | ||
816 | - | ||
817 | - Update your application to handle this. | ||
818 | - | ||
819 | -3. By default, `where` conditions apply to aggregations. This is equivalent to `smart_facets: true`. If you have `smart_facets: true`, you can remove it. If this is not desired, set `smart_aggs: false`. | ||
820 | - | ||
821 | -4. If you have any range facets with dates, change the key from `ranges` to `date_ranges`. | ||
822 | - | ||
823 | - ```ruby | ||
824 | - facets: {date_field: {ranges: date_ranges}} | ||
825 | - # to | ||
826 | - aggs: {date_field: {date_ranges: date_ranges}} | ||
827 | - ``` | ||
828 | - | ||
829 | ### Highlight | 772 | ### Highlight |
830 | 773 | ||
831 | Specify which fields to index with highlighting. | 774 | Specify which fields to index with highlighting. |