We have a list that is now over 5000 and the following stopped working. All the fields used in filters are indexed
var requestPendUri = webAbsUrl + "/_api/web/Lists/getByTitle('LeaveRequest')/Items?$\
filter=(((Manager0 eq '" + str + "') and (Status eq 'Pending'))\
or ((AltManager eq '" + str + "') and (Status eq 'Pending'))\
or ((Manager0 eq '" + str + "') and (ChangeStatus eq 'Pending'))\
or ((AltManager eq '" + str + "') and (ChangeStatus eq 'Pending')))&$\
select=Id&$\
top=500";
var ajaxPendCount = $.ajax({
url: requestPendUri,
async: false, //pass value outside of ajax
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
myCount = data.d.results.length;
},
error: function (data) { alert("Failed to count items."); }
});
I've read through Manage large lists and libraries in SharePoint. Each view is filtered and columns are indexed but still not sure how to work around the issue with REST.
EDIT
I typed https://tenant.sharepoint.com/_api/web/Lists/getByTitle('LeaveRequest')/Items?$filter=(((Manager0 eq '[email protected]') and (Status eq 'Pending')) or ((AltManager eq '[email protected]') and (Status eq 'Pending')) or ((Manager0 eq '[email protected]') and (ChangeStatus eq 'Pending')) or ((AltManager eq '[email protected]') and (ChangeStatus eq 'Pending')))
replacing all [email protected]
with actual email address but IE just displayed `The website cannot display the page.
But, it seems to display data if I break it down to https://tenant.sharepoint.com/_api/web/Lists/getByTitle('LeaveRequest')/Items?$filter=((Manager0 eq '[email protected]') and (Status eq 'Pending')) or ((Manager0 eq '[email protected]') and (ChangeStatus eq 'Pending'))
and
https://tenant.sharepoint.com/_api/web/Lists/getByTitle('LeaveRequest')/Items?$filter=((AltManager eq '[email protected]') and (Status eq 'Pending')) or ((AltManager eq '[email protected]') and (ChangeStatus eq 'Pending'))