When I am trying to search using metadata in the document library getting the below error
However, whenever I am searching on the OOTB Modern SPO search page, it's giving me the result using same metadata.
I can reproduce your issue.
The error is in response to the View setting of list. You unknowingly was attempting to have many Lookup columns in a single View.
SharePoint Online limits the number of lookup column. Lists created prior to the June 2013 CU update are capped at 8 lookup columns, while those afterward are allowed 12.
Although the official said can have 12 Lookup fields under a single View. But in my test environment, the number of Lookup fields cannot exceed 10, otherwise an error will occur.
Once I edited the view to only contain a few Lookup columns in the default, the problem stopped.
I found a solution to my issue. Actually, I created library views using a script as part of site provision, and just editing the views manually solved the issue in my case.
- Open view
- Edit view (not made any changes in view)
- Save view