Algolia Search api returns maximum 1000 records while my total records are around 50000
Asked Answered
D

3

21

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?

Disservice answered 20/5, 2016 at 12:34 Comment(2)
Please add a minimal code example to help people answer your question.Unanimous
Thanks its there now...Disservice
R
17

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

Ruction answered 20/5, 2016 at 12:46 Comment(1)
let me try and get back to youDisservice
S
9

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.

Serum answered 3/6, 2016 at 11:54 Comment(0)
H
3

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

Haileyhailfellowwellmet answered 20/5, 2016 at 12:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.