Settings
List of methods
Get settings |
Get the settings of an index. |
Set settings |
Change an index’s settings. |
Copy settings |
Copy the settings of an index to another index on the same app. |
It’s recommended to use the Kotlin API client, which is better suited for Android development.
We released a new version of the JavaScript API client in public beta. Read the beta documentation for more information.
We released a new version of the PHP API client in public beta. Read the beta documentation for more information.
We released a new version of the Java API client in public beta. Read the beta documentation for more information.
The scope of settings (and parameters)
You can add settings when configuring an index, or when performing a search query. In both cases, settings are sent to Algolia using parameters.
- When adding settings to an index, use the
setSettings
method. - When adding settings to a search query, add the settings as parameters to the
search
method.
Each parameter has a scope:
Scope: settings
Parameters with scope settings
can only be configured on an index with the setSettings
method.
They’re not available as search parameters.
Index settings are built directly into your index and they impact every search.
Scope: search
Individual queries can be parameterized by adding search parameters to the search
method.
These parameters affect only those queries that use them; they don’t set any index defaults.
Scope: settings
and search
When applying both, you set an index default with the setSettings
method.
These settings are then overridden by the parameters you add to your search
method.
You can override only some settings. Check each settings’ reference documentation to see its scope.
If you don’t apply an index setting or search parameter, Algolia applies an engine-level default.
Example
In this example, all queries performed on this index use a queryType
of prefixLast
:
1
2
3
4
5
index.setSettings({
queryType: 'prefixLast'
}).then(() => {
// done
});
Now, every query applies a prefixLast
logic.
You can override this at search time.
For example, the next query overrides that index setting with prefixAll
:
1
2
3
4
5
index.search('query', {
queryType: 'prefixAll'
}).then(() => {
// done
});
Settings categories
To help you navigate the list of settings, they can be grouped into the following categories: