Users may define custom DocumentDB metrics using metric type AzureDocumentDbScript. The result returned by the query can't exceed the 64 KB limit after serialization. Since the AzureDocumentDbScript returns a JSON object, it's possible that the returned result exceeds the limit. 

If necessary, modify your query by limiting the number of objects or properties that are retrieved.