@@ -2805,6 +2805,37 @@ public ListenableFuture<List<PointGroup>> queryGroupsAsync(
28052805 future , response -> response .getResult ().getGroupsList (), MoreExecutors .directExecutor ());
28062806 }
28072807
2808+ /**
2809+ * Perform facet counts. For each value in the field, count the number of points that have this
2810+ * value and match the conditions.
2811+ *
2812+ * @param request the facet counts request
2813+ * @return a new instance of {@link ListenableFuture}
2814+ */
2815+ public ListenableFuture <List <Points .FacetHit >> facetAsync (Points .FacetCounts request ) {
2816+ return facetAsync (request , null );
2817+ }
2818+
2819+ /**
2820+ * Perform facet counts. For each value in the field, count the number of points that have this
2821+ * value and match the conditions.
2822+ *
2823+ * @param request the facet counts request
2824+ * @param timeout the timeout for the call.
2825+ * @return a new instance of {@link ListenableFuture}
2826+ */
2827+ public ListenableFuture <List <Points .FacetHit >> facetAsync (
2828+ Points .FacetCounts request , @ Nullable Duration timeout ) {
2829+ Preconditions .checkArgument (
2830+ !request .getCollectionName ().isEmpty (), "Collection name must not be empty" );
2831+
2832+ logger .debug ("Facet on '{}'" , request .getCollectionName ());
2833+ ListenableFuture <Points .FacetResponse > future = getPoints (timeout ).facet (request );
2834+ addLogFailureCallback (future , "Facet" );
2835+ return Futures .transform (
2836+ future , Points .FacetResponse ::getHitsList , MoreExecutors .directExecutor ());
2837+ }
2838+
28082839 // region distance matrix
28092840
28102841 /**
0 commit comments