I have also observed the same behaviour as @lui.
I have a test SharePoint list with exactly 20,000 records. I have created a column called Color which for testing purposes has exactly 7 records with the value Grey at the following IDs
| ID |
| 1 |
| 6001 |
| 19801 |
| 19811 |
| 19819 |
| 19976 |
| 20000 |
I have tested multiple configurations of the Get Items action to test the behaviour, see outcome below:
| Filter Query | Order By | Top Count | Pagination | Limit | IDs Returned |
| Color eq 'Grey' | ID asc | Blank | Off | N/a | ID: [1] |
| Color eq 'Grey' | ID desc | Blank | Off | N/a | ID: [20000; 19976; 19819; 19811; 19801] |
| Color eq 'Grey' | ID desc | 2 | Off | N/a | ID: [20000; 19976] |
| Color eq 'Grey' | ID asc | 1 | On | 1 | ID: [1] |
| Color eq 'Grey' | ID asc | Blank | On | 100 | All 7 |
| Color eq 'Grey' | ID asc | 1 | On | 100 | 100 records with duplicates? |
| Color eq 'Grey' | ID asc | 3 | On | 100 | All 7 |
| Color eq 'Grey' | ID asc | Blank | On | 1000 | All 7 |
| Color eq 'Grey' | ID asc | 3 | On | 1000 | All 7 |
| Color eq 'Grey' | ID asc | Blank | On | 10000 | All 7 |
| Color eq 'Grey' | ID asc | 1 | On | 10000 | Flow Run timeout |
| Color eq 'Grey' | ID asc | 3 | On | 10000 | All 7 |
| Color eq 'Grey' | ID asc | 5 | On | 10000 | 8 records with a duplicate? [19801 duplicated] |
| Color eq 'Grey' | ID asc | 3 | On | 20000 | All 7 |
From the above, it seems that:
- Without enabling pagination, you are only able to access the 5000 items prior to filtering and then the output be based on whatever is filtered from these 5000 items.
- Without enabling pagination, the top count will work as expected.
- With pagination enabled and no top count applied, it seems you can retrieve all of the expected data regardless of the pagination threshold limit.
- With pagination enabled the top count seems to be ignored and sometimes even exhibits strange behaviour of causing duplicates.
I do not understand how these settings should be configured and their limit.
Another approach is to create an indexed column which appears to solve the issue without requiring pagination at all. However, the limit of this approach is not clear to me. With 20,000 records it is working, but what happens if there were 1,000,000 records will this still work?
Creating an indexed column seems to be the only approach that allows for the top count to work when dealing with 5000+ records
| Filter Query | Order By | Top Count | Pagination | Limit | Column Index | IDs Returned |
| Color eq 'Grey' | ID asc | Blank | Off | N/a | Color indexed | All 7 |
| Color eq 'Grey' | ID asc | 3 | Off | N/a | Color indexed | ID [1; 6001; 19801] |