My goal is to query the resultRecordCount with returnDistinctValues = true with one output field. Reason is because the result is sometimes more than 1000 and I need to paginate the queries and I can't do that without knowing the total number of distinct results.
However, it seems that resultRecordCount is ignoring the returnDistinctValues parameter and counting everything. Is there another way I can count distinct records? Maybe with some trickery using outStatistics or groupByFieldsForStatistics? I'm on ArcGIS Enterprise 10.5.1 calling REST MapServer through ArcGIS API for JavaScript 4.7.