I am using SOSL to search records in Salesforce. According to document http://www.salesforce.com/us/developer/docs/soql_sosl/Content/sforce_api_calls_sosl_limit.htm, It should return 2000 records but it's only returning 500 records.

SOSL query: FIND {Not Given} RETURNING " +  "Lead(Id, Phone, FirstName, LastName)

I verified by running following SOQL query that more than 500 records exist for this criteria.

Select Id, Name from Lead where LastName like '%Not Given%'

One interesting thing to note is - this 500 limit seems to be per Object, not per query. Because on running following query

FIND {Not Given} RETURNING " +  "Lead(Id, Phone, FirstName, LastName), Account(Id)

It returns 500 leads and 13 Accounts.

Any suggestions where is this limit coming from?

EDIT: I tried to use Developer Console in Salesforce website and run SOSL query directly in it. It is also returning only 500 records. So Seems like this limit is like some organization wide limit. I asked our Salesforce admin but he couldn't find out.

I am using enterprise wsdl version no 28.0. Though using WSC-23.0 to generate classes from wsdl. Could this be an issue?

3 Answers 3


I believe the default batch size is 500 records and the maximum batch size permitted is 2000 records - this limit was increased as part of the Summer 13 release

The issue you are facing may be because you are using the older WSC-23.0 release. You should test with a newer API version to test that it resolves the issue.

On a related note, you can programatically change the batch size using queryMore()

  • queryMore is not supported in search API. I'll have to try with latest WSC release. Jan 7, 2014 at 0:34

Try to add "where part".

Example: Lead (Id where Id!=null). I don't know why but I had the same problem and it works with that.

  • 1
    !=null is a performance killer because it will trigger a full table scan. If you're truly advising this, some more elaboration would be welcome. Jan 6, 2014 at 15:51

look at the funnel example in the sosl limits.. it does not search in all records and it is not clear in how many records it searches...


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .