Unable to query list getting Field 'Title' cannot be referenced

McCarthy Chris 0 Reputation points
2023-09-04T13:00:16.2433333+00:00

Unable to filter any list on a Sharepoint site I'm getting the following error I have tried setting the headers but no difference and the lists are filtered.

Field 'Title' cannot be referenced in filter or orderby as it is not indexed. Provide the 'Prefer: HonorNonIndexedQueriesWarningMayFailRandomly' header to allow this, but be warned that such queries may fail on large lists.
Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-09-05T05:49:42.0166667+00:00

    Hi @McCarthy Chris,

    It seems that you are having trouble filtering a SharePoint list that has more than 5,000 items. This is a common issue that occurs when the list exceeds the list view threshold limit. To fix this, you need to do two things:

    First, you need to create an indexed column for the field that you want to filter by. For example, if you want to filter by Title, you need to create an index for the Title column. You can do this by going to List settings > Columns > Title > Create an index. Note that the list limit to add or remove an indexed column is 20,000 items.

    https://learn.microsoft.com/en-us/sharepoint/troubleshoot/lists-and-libraries/fails-filtering-sharepoint-column

    Second, you need to modify your view to use the indexed column and filtering to reduce the number of items displayed in the view to 5,000 or less. You can do this by going to List settings > Views > Your view > Filter. For example, you can filter by Title is equal to some value or Title begins with some letter.

    If you still get the error after doing these steps, you may need to reindex your list to refresh the index data. You can do this by going to List settings > Advanced settings > Reindex List. This may take some time depending on the size of your list.

    Here are some links for your reference:

    https://sharepoint.stackexchange.com/questions/284172/sharepoint-online-filter-by-not-showing-all-available-options

    https://stackoverflow.com/questions/49169917/microsoft-graph-honornonindexedquerieswarningmayfailrandomly-error-when-filterin


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards

    Cheng Feng


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.