This is the unified documentation for Retail API. This includes Recommendations AI, Retail Search, and the unified Retail console (which is applicable to both Recommendations AI and Retail Search users). To use the new console or Retail Search while they are in the restricted GA phase, submit a form here to contact Cloud sales. If you are using the v1beta version of Recommendations AI, migrate to the GA version: Migrating to the Retail API from beta.

To see documentation for only Recommendations AI and the Recommendations AI-only console, go to the How-to guides for Recommendations AI and the API reference documentation for Recommendations AI.

Boosting results

This page outlines boosting of search results.

Example dataset

This page uses the following dataset as an example. Only the fields necessary for explanation are included.


See Filtering and ordering for the filter expression syntax.


With boosting, you could control the result ranking by apply a boost to prioritize or deprioritize the results.

For example, if you search for "Google speaker", then you would get "nest_mini_2nd_gen", "nest_audio", "nest_hub_max", "nest_hub", "google_home_max" and "google_home_mini" in no specific order.


public static SearchResponse searchProductsWithBoostSpec(String query, int pageSize,
    String condition, float boostStrength) throws IOException, InterruptedException {
  SearchServiceClient searchClient = getSearchServiceClient();

  BoostSpec boostSpec = BoostSpec.newBuilder()

  SearchRequest searchRequest = SearchRequest.newBuilder()

  SearchResponse response =;

  searchClient.awaitTermination(2, TimeUnit.SECONDS);

  return response;

Suppose that you would like to prioritize the cheaper products (less than 95 dollars) and deprioritize the expensive ones (higher than 95 dollars), you could apply a boost spec as:


  condition_boost_specs {
    condition: "price: IN(*, 95.0e)"
    boost: 0.5
  condition_boost_specs {
    condition: "price: IN(95.0e, *)"
    boost: -0.5

In the result, "nest_mini_2nd_gen", "google_home_mini" and "nest_hub" might the first three, while "nest_audio", "nest_hub_max" and "google_home_max" might be last three. However, no specific order is guaranteed, which is different from ordering by price, as discussed in Filtering and ordering.