Boost results

This page outlines boosting of search results.

Boosting tutorial

This tutorial shows you some examples of product boosting.

To follow step-by-step guidance for this task directly in the Cloud Shell Editor, click Guide me:

Guide me

Example dataset

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


See Filter and order results for the filter expression syntax.


With boosting, you can 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 void searchProductsWithBoostSpec(String query, int pageSize,
    String condition, float boostStrength) throws IOException, InterruptedException {
  BoostSpec boostSpec = BoostSpec.newBuilder()

  SearchRequest searchRequest = SearchRequest.newBuilder()

  try (SearchServiceClient searchClient = SearchServiceClient.create()) {
    SearchResponse response =;
    System.out.println("Search response: " + searchResponse);

Suppose that you want to prioritize the cheaper products (less than 95 dollars) and deprioritize the expensive ones (higher than 95 dollars). You can 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 be 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 Filter and order results.