My index in Algolia contains around 50k records. While using javascript api for retrieving records it only returns maximum 1000 records, i am using search() function. Any suggestions?
search()
function by default returns only 1000 records. If in case you need to retrieve more than 1000 records you should use browse()
function instead. However search function is more optimised then browse function.
Always prefer search()
over browse unless you really want to retrieve all your records(for backup purpose).
Reference to API doc: Browse All Index Content
Actually, Algolia doesn't return more than 1000 result. However, the response contains a cursor that you can use to access the next elements with the "browseFrom" function. You probably want to use the browseAll function instead which lets you access all the elements sequentially.
The search()
function is, indeed, only able to retrieve you 1000 results at max. Most of the time, you don't need to retrieve so many results because you probably just want to display a few of them.
However, if you really need to access all your records, for backup or anything else, you should use the browse()
function which does exactly that. :)
More informations here on this FAQ page
© 2022 - 2024 — McMap. All rights reserved.