add single document API & indices API refactor