Field Stats

The stats.field parameter allows you to display the maximum and minimum values of any numeric field in your data set for a user query. With this parameter, you can get all the documents matching a query and display the minimum and maximum values of specific attributes such as price, sale_price, length, width, reviews, and so on.

688688

Price range element with maximum and minimum values

Note: This parameter is supported for single-valued numeric attributes only.

Example

&stats.field=sale_price,price,MARGIN_DOLLAR
{
"response": ...
"facet_counts:" ...
"stats":{  
   "stats.field":{  
      "sale_price":{  
         "max":2449.99,
         "min":0.69
      },
      "price":{  
         "max":2449.99,
         "min":0.69
      },
      "MARGIN_VALUE":{  
         "max":0.91,
         "min":0
}
}

Use case

The stats.field parameter can be used to display the price range (max-min) in the UI as a price slider. When the user performs a search query, the maximum and minimum price of the queried product is displayed with stats.field. This parameter can also be used for other numeric attributes such as review, length, width, and so on.