Add java api way to create index.