> ## Documentation Index
> Fetch the complete documentation index at: https://www.algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get trending items

> Retrieve global trending items.

> [!NOTE]
>
> This page documents an earlier version of the API client.
> For the latest version, see [Retrieve recommendations](https://www.algolia.com/doc/libraries/sdk/methods/recommend/get-recommendations.md).

**Required ACL:** `search`

> [!NOTE]
>
> This method is only available in the JavaScript API client.

Retrieve trending items for a specific facet when you pass `facetName` and `facetValue`.

## Examples

```js JavaScript icon=code theme={"system"}
recommendClient
  .getTrendingItems([
    {
      indexName: "INDEX_NAME",
      threshold: 80,
      facetName: "category",
      facetValue: "sweaters",
    },
  ])
  .then(({ results }) => {
    console.log(results);
  })
  .catch((err) => {
    console.log(err);
  });
```

## Parameters

**requests** `object[]` *required*

**indexName** `string` *required*

The name of the target index.

**facetName** `string`

The facet attribute for which to recommendations.

**facetValue** `string`

The facet value for which to get recommendations.

**fallbackParameters** `object`

List of [search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters.md) to use as fallback when there are no recommendations,
except: `page`, `hitsPerPage`, `offset`, `length`.

**maxRecommendations** `integer`

The maximum number of recommendations to retrieve.
Depending on the available recommendations and the other request parameters,
the actual number of hits may be lower.
If `maxRecommendations` isn't provided or set to 0,
all matching recommendations are returned, and no fallback request is performed.

**queryParameters** `object`

List of [search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters.md) to filter the recommendations,
except `page`, `hitsPerPage`, `offset`, `length`.

**threshold** `number`

Threshold for the recommendations confidence score (between 0 and 100).
Only recommendations with a greater score are returned.

## Response

**results** `object[]`

List of results in the order they were submitted, one per query.

**Example:**

```jsonc JSON icon=braces theme={"system"}
{
  "results": [
    {
      "hits": [
        {
          // ...,
          "_score": 32.72
        }
      ],
    },
  ]
}
```

**\_score** `number`

The confidence score of the recommended item, the closer it is to 100, the more relevant.

### 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.

```jsonc JSON icon=braces theme={"system"}
{
  "results": [
    {
      "hits": [
        {
          "_highlightResult": {
            "category": {
              "matchLevel": "none",
              "matchedWords": [],
              "value": "Men - T-Shirts"
            },
            "image_link": {
              "matchLevel": "none",
              "matchedWords": [],
              "value": "https://example.org/image/D05927-8161-111-F01.jpg"
            },
            "name": {
              "matchLevel": "none",
              "matchedWords": [],
              "value": "Jirgi Half-Zip T-Shirt"
            }
          },
          "_score": 32.72,
          "category": "Men - T-Shirts",
          "image_link": "https://example.org/image/D05927-8161-111-F01.jpg",
          "name": "Jirgi Half-Zip T-Shirt",
          "objectID": "D05927-8161-111",
          "position": 105,
          "url": "men/t-shirts/d05927-8161-111"
        }
      ],
      "processingTimeMS": 1,
    }
  ]
}
```
