0
votes

Good morning.

My problem, as usual, is the SharePoint Online Threshold.

I’ve a custom list with a lot of items (> 5.000) and I need to perform queries on this list by using REST API calls.

This list schema is: Title, Field1 and Field2.

Field1 and Field2 are Short Text INDEXED columns.

Well… I need to query this list by filtering by Field1 OR by Field2

https://asdasd.sharepoint.com/sites/xxxx/_api/web/lists/GetByTitle('Big01')/items?$filter=(Field1 eq 'Value1 53') or (Field2 eq 'Value2 25')

Despite both Field1 and Field2 are indexed fields and the result of this query is definitely less then 5.000 items (2 items), I get the threshold error.

{"odata.error":{"code":"-2147024860, Microsoft.SharePoint.SPQueryThrottledException","message":{"lang":"en-US","value":"The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator."}}}

If I perform query on single field like the follows, all works fine, but if I try to combine the two condition (OR), I get SPQueryThrottledException.

https:// asdasd.sharepoint.com/sites/ xxxx/_api/web/lists/GetByTitle('Big01')/items?$filter=(Field1 eq 'Value1 53')

https:// asdasd.sharepoint.com/sites/xxxx/_api/web/lists/GetByTitle('Big01')/items?$filter=(Field2 eq 'Value2 25')

Any ideas?

Thanks,

Sergio

1

1 Answers

0
votes

OR filter condition in the Rest API will loop and filter the items with 2 times, so the total count to filter will exceed the list view threshold. One Solution is to call the single filter with 2 Separated ajax call and combine the data.