Skip to main content
This page documents an earlier version of the API client. For the latest version, see Retrieve recommendations.
Required ACL: search
This method is only available in the JavaScript API client.

Examples

JavaScript
recommendClient
  .getTrendingFacets([
    {
      indexName: "your_index_name",
      threshold: 80,
      facetName: "movie_genre",
    },
  ])
  .then(({ results }) => {
    console.log(results);
  })
  .catch((err) => {
    console.log(err);
  });

Parameters

requests
object[]
required

Response

results
object[]
List of #s in the order they were submitted, one per query.Example:
JSON
{
  "results": [
    {
      "hits": [
        {
          // ...,
          "_score": 32.72
        }
      ],
    },
  ]
}

Response as JSON

This section shows the JSON response returned by the API. Each API client wraps this response in language-specific objects, so the structure may vary. To view the response, use the getLogs method. Don’t rely on the order of properties—JSON objects don’t preserve key order.
JSON
{
  "results": [
    {
      "exhaustiveNbHits": true,
      "exhaustiveTypo": true,
      "hits": [
        {
          "_score": 98,
          "facetName": "movie_genre",
          "facetValue": "adventure"
        },
        {
          "_score": 91.02,
          "facetName": "movie_genre",
          "facetValue": "action"
        },
        {
          "_score": 82,
          "facetName": "movie_genre",
          "facetValue": "thriller"
        }
      ],
      "hitsPerPage": 1000,
      "nbHits": 3,
      "nbPages": 1,
      "page": 0
    }
  ]
}
I