Add java api for index.