---
title: "The suggestion response object"
slug: "the-suggestion-response-object"
abstract: "Describes the structure and properties of the suggestion object in a Sitecore Discover Search and Recommendation response."
---
# The suggestion response object

You get a response `suggestion` JSON object in a Sitecore Discover Search and Recommendation response if you send a [suggestion object in the request](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/integrate-using-discover-rest-apis/search-and-recommendation-data-model/response-structure-and-objects/the-suggestion-request-object.md "The suggestion request object"). The response returns suggestions on your query based on different algorithms like autocomplete and query expansion.

The following shows the basic structure of the `suggestion` object in a response:

```csharp
{
    "suggestion": {
	"<suggestion_type>": {
		"value": [{
			"id": "<suggestion_value_id>",
			"text": "<display_text>,
			"in_content": "<content_type>",
			},
			"with_filter": {
                            "filter_id": "<filter_value_id>",
			    "text": "<display_text>,
			    "min": 1,
			    "max": 10
		        }
		}]
	}
    }

}
```

<details>
<summary><h2>Keys</h2></summary>

Depending on your request you might see some or all response keys.

The following table describes the keys in the `suggestion` response object:

| Parameters | Key | Description | Value |
| --- | --- | --- | --- |
| suggestion_type | Suggestion type object | Returns the specific algorithm used for generating the suggestion.NoteIf you added a suggestion object in your request, the response automatically returns an autocomplete suggestion regardless of the <suggestion_type> you requested. | keyphrasecategorytrending_categoryautocompleterecentSee suggestion types for details. |

### Suggestion type object

The following table describes the keys in the `suggestion_type` object:

| Parameters | Key | Description | Suggestion types |
| --- | --- | --- | --- |
| `id` | string | A unique ID that corresponds to the suggested value.<br><br>You can use either the `id` or `text` for future query requests. |     |
| `with_filter` | object | You see this only if a specific filter is applied to the `suggestion`. |     |
| `filter_id` | string | Unique ID that corresponds to the filter value. |     |
| `text` | string | Display name of the filtered item. |     |

### Suggestion types

The following are different types or algorithms for generating the suggestion

| <suggestion_type> | Description | Value |
| --- | --- | --- |
| keyphrase | A mix of suggestions. | type_correction,autocomplete,query_expansionrelated_search |
| category | Categories that contain the searched term. | n/a |
| trending_category | A category that is trending now. | n/a |
| autocomplete | Completion of a keyphrase and predicting the possible search term based on earlier typed values. | n/a |
| recent | Recent search history. | n/a |

</details>

<details>
<summary><h2>Related key</h2></summary>

The following table describes the key related to the `suggestion` response.

| Key | Type | Description |
| --- | --- | --- |
| request_for | Array | Fields that Discover autocorrects.NoteThe response can return a modified keyphrase if you added both request_for and suggestion objects in your request. |

</details>

<details>
<summary><h2>Example</h2></summary>

The following code is an example of a response with a `keyphrase` suggestion using `query_expansion`:

```csharp
{
    "suggestion": {
	"query_expansion": {
		"value": [{
			"id": "pkel1Q",
			"text": "Men's Shirt",
			"in_content": "product"
			},
    			{
		        "id": "msa2fwS",
			"text": "Men's Styles",
			"in_content": "article",
			"with_filter": {
			    "filter_id": "clothing_id123",
			    "text": "Clothing"
			 }
		      }]
	}
    }
}
```

The next example shows a response that returns an autocorrected `keyphrase` from the original misspelled search term. This applies if a `suggestion` object is added to the request.

```csharp
{
    "request_for": {
        "query": {
            "orig_keyphrase": "chacolate",
            "keyphrase": "chocolate"
        }
    }
```

</details>