As of 0.20.0, ParadeDB has migrated to a new SQL syntax. The old syntax is still supported and we have preserved the legacy docs here.
0.20.0
Count the number of occurrences over user-defined buckets
SELECT pdb.agg('{"range": {"field": "rating", "ranges": [{"to": 3.0 }, {"from": 3.0, "to": 6.0} ]}}') FROM mock_items WHERE id @@@ pdb.all();
agg ---------------------------------------------------------------------------------------------------------------------------------------------------------------- {"buckets": [{"to": 3.0, "key": "*-3", "doc_count": 4}, {"to": 6.0, "key": "3-6", "from": 3.0, "doc_count": 37}, {"key": "6-*", "from": 6.0, "doc_count": 0}]} (1 row)
Was this page helpful?