Dixit Singla
Dixit Singla

Reputation: 2620

How to return all the results in search:search API?

I am using search:search API and came across a scenario in which I want all the docs returned.

I know it will impact the performance but I can bear this as I know there won't be more than 30-50 docs.

I can set the max threshold value which is 50, but just want to know is there way to return all the results.

If in future the count increases I don't need to change the threshold value.

Upvotes: 0

Views: 147

Answers (1)

grtjn
grtjn

Reputation: 20414

You can specify a large pageLength, something like 999 or even bigger.

I'd go for something smaller though, and put in logic that checks whether total count exceeds pageLength, and print a notification if that occurs..

HTH!

Upvotes: 3

Related Questions