Query Suggestions API (1.0.0)
Download OpenAPI specification:Download
The Query Suggestions API lets you manage Algolia's Query Suggestions configurations. Query Suggestions add new indices with popular search queries, external suggestions, or facet values to your Algolia application. In your user interface, you can query the Query Suggestions indices like regular indices and add suggested searches to guide users and speed up their search.
List configurations
List all Query Suggestions configurations of your Algolia application.
Authorizations:
Responses
Response samples
- 200
- 401
[- {
- "appId": "string",
- "sourceIndicesAPIKey": "string",
- "suggestionsIndicesAPIKey": "string",
- "externalIndicesAPIKey": "",
- "indexName": "products_query_suggestions",
- "sourceIndices": [
- {
- "indexName": "products",
- "replicas": false,
- "analyticsTags": [
- "string"
], - "facets": [
- {
- "attribute": "category",
- "amount": 3
}, - {
- "attribute": "brand",
- "amount": 2
}
], - "minHits": 5,
- "minLetters": 4,
- "generate": [
- [
- "color",
- "brand"
]
], - "external": [
- "string"
]
}
], - "languages": [
- "string"
], - "exclude": [
- "string"
], - "enablePersonalization": false,
- "allowSpecialCharacters": false
}
]
Create a configuration
Create a new Query Suggestions configuration.
You can have up to 100 configurations per Algolia application.
Authorizations:
Request Body schema: application/json
indexName required | string (indexName) Query Suggestions index name. |
required | Array of objects (sourceIndices) non-empty Algolia indices from which to get the popular searches for query suggestions. |
Array of languages (strings) or languages (boolean) (languages) Set the language for deduplicating singular and plural suggestions. If specified, only the more popular form is included. | |
exclude | Array of strings or null Patterns to exclude from query suggestions. |
enablePersonalization | boolean Default: false Turn on personalized query suggestions. |
allowSpecialCharacters | boolean Default: false Allow suggestions with special characters. |
Responses
Request samples
- Payload
{- "indexName": "products_query_suggestions",
- "sourceIndices": [
- {
- "indexName": "products",
- "replicas": false,
- "analyticsTags": [
- "string"
], - "facets": [
- {
- "attribute": "category",
- "amount": 3
}, - {
- "attribute": "brand",
- "amount": 2
}
], - "minHits": 5,
- "minLetters": 4,
- "generate": [
- [
- "color",
- "brand"
]
], - "external": [
- "string"
]
}
], - "languages": [
- "string"
], - "exclude": [
- "string"
], - "enablePersonalization": false,
- "allowSpecialCharacters": false
}
Response samples
- 200
- 400
- 401
- 422
- 500
{- "status": 200,
- "message": "Configuration was created, and a new indexing job has been scheduled."
}
Get a configuration
Get a single Query Suggestions configuration.
Authorizations:
path Parameters
indexName required | string (indexName) Example: products_query_suggestions Query Suggestions index name. |
Responses
Response samples
- 200
- 400
- 401
- 404
{- "appId": "string",
- "sourceIndicesAPIKey": "string",
- "suggestionsIndicesAPIKey": "string",
- "externalIndicesAPIKey": "",
- "indexName": "products_query_suggestions",
- "sourceIndices": [
- {
- "indexName": "products",
- "replicas": false,
- "analyticsTags": [
- "string"
], - "facets": [
- {
- "attribute": "category",
- "amount": 3
}, - {
- "attribute": "brand",
- "amount": 2
}
], - "minHits": 5,
- "minLetters": 4,
- "generate": [
- [
- "color",
- "brand"
]
], - "external": [
- "string"
]
}
], - "languages": [
- "string"
], - "exclude": [
- "string"
], - "enablePersonalization": false,
- "allowSpecialCharacters": false
}
Update a configuration
Update a QuerySuggestions configuration.
Authorizations:
path Parameters
indexName required | string (indexName) Example: products_query_suggestions Query Suggestions index name. |
Request Body schema: application/json
required | Array of objects (sourceIndices) non-empty Algolia indices from which to get the popular searches for query suggestions. |
Array of languages (strings) or languages (boolean) (languages) Set the language for deduplicating singular and plural suggestions. If specified, only the more popular form is included. | |
exclude | Array of strings or null Patterns to exclude from query suggestions. |
enablePersonalization | boolean Default: false Turn on personalized query suggestions. |
allowSpecialCharacters | boolean Default: false Allow suggestions with special characters. |
Responses
Request samples
- Payload
{- "sourceIndices": [
- {
- "indexName": "products",
- "replicas": false,
- "analyticsTags": [
- "string"
], - "facets": [
- {
- "attribute": "category",
- "amount": 3
}, - {
- "attribute": "brand",
- "amount": 2
}
], - "minHits": 5,
- "minLetters": 4,
- "generate": [
- [
- "color",
- "brand"
]
], - "external": [
- "string"
]
}
], - "languages": [
- "string"
], - "exclude": [
- "string"
], - "enablePersonalization": false,
- "allowSpecialCharacters": false
}
Response samples
- 200
- 401
- 500
{- "status": 200,
- "message": "Configuration was updated, and a new indexing job has been scheduled."
}
Delete a configuration
Delete a Query Suggestions configuration.
Deleting only removes the configuration and stops updates to the Query Suggestions index. The Query Suggestions index itself is not deleted.
Authorizations:
path Parameters
indexName required | string (indexName) Example: products_query_suggestions Query Suggestions index name. |
Responses
Response samples
- 200
- 401
- 500
{- "status": 200,
- "message": "Configuration was deleted with success."
}
Get configuration status
Report the status of a Query Suggestions index.
Authorizations:
path Parameters
indexName required | string (indexName) Example: products_query_suggestions Query Suggestions index name. |
Responses
Response samples
- 200
- 401
- 404
{- "indexName": "products_query_suggestions",
- "isRunning": false,
- "lastBuiltAt": "2023-07-05T08:03:53Z",
- "lastSuccessfulBuiltAt": "2023-07-05T08:03:53Z",
- "lastSuccessfulBuildDuration": 28
}
Get logs
Get the logs for a single Query Suggestions index.
Authorizations:
path Parameters
indexName required | string (indexName) Example: products_query_suggestions Query Suggestions index name. |
Responses
Response samples
- 200
- 401
- 404
{- "timestamp": "2023-07-05T08:03:33.898076171Z",
- "level": "SKIP",
- "message": "skipping query \"Brooke Adams\": not enough search results, got 1, expected 5",
- "contextLevel": 1
}