Distinct count in kibana

Hi,

I have a serious problem with distinct count of two fields.

patientID - "1" doctor - "sanjay" test - "x"
patientID - "2" doctor - "sanjay" test - "x"
patientID - "1" doctor - "sanjay" test - "y"
patientID - "1" doctor - "vijay" test - "y"
patientID - "2" doctor - "vijay" test - "x"
patientID - "1" doctor - "sanjay" test - "z"
patientID - "1" doctor - "vijay" test - "z"

Here, the relation between the three fields is "patient-1 going to the doctor-sanjay for a test-x"

Now, I'm not considering test field. I want distinct count of patients for each doctor.
Please help me in getting out of this issue.

Thanks & Regards,
sanjay