function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Salesforce P1Salesforce P1 

Big Objects - Filters may not have any gaps within the composite key

Hi,

We have created a Big Object with the Index configured with 2 fields. We have a SOQL in Apex , having filter criteria on both the index fields. However, still we are encountering the error 'Filters may not have any gaps within the composite key'. Any one who came across this behaviour and has any work around, please share your thoughts.User-added image
Best Answer chosen by Salesforce P1
Salesforce P1Salesforce P1
Figured out. After including the Indexed fields in the ORDER BY, i am able to get through it! Thanks

All Answers

SwethaSwetha (Salesforce Developers) 
HI,
Considering the best practices for querying with Big objects, we need to query with filters without leaving any gaps between the first and the last field in the query.

See related posts:
https://developer.salesforce.com/docs/atlas.en-us.bigobjects.meta/bigobjects/big_object_querying.htm

 https://salesforce.stackexchange.com/questions/248375/indexed-big-object-soql-limitation-in-apex-class

https://developer.salesforce.com/forums/?id=9062I000000g8aQQAQ

If this information helps, please mark the answer as best. Thank you
Salesforce P1Salesforce P1
Hi Swetha,
As i mentioned, we have covered all the index fields in the SOQL criteria, still the error persists.
Salesforce P1Salesforce P1
Figured out. After including the Indexed fields in the ORDER BY, i am able to get through it! Thanks
This was selected as the best answer