From official documentation:
recordsTotal
Total records, before filtering (i.e. the total number of records in the database)
recordsFiltered
Total records, after filtering (i.e. the total number of records after filtering has been applied - not just the number of records being returned for this page of data).
Your response should be:
{
"draw": 1,
"recordsTotal": 10000,
"recordsFiltered": 3000,
"data": [
// ... skipped 20 records ...
]
}
I believe recordsTotal is only used for informational panel Showing 1 to 20 of 3000 entries (filtered from 10000 total entries). If you're not using informational panel, you don't have to return recordsTotal property.
Property recordsFiltered is also used by jQuery DataTables to calculate number of pages required to display your dataset.
See Server-side - Returned data for more information.