Java API to create index with date

If I want to have my index rotated daily, so I would need to pass the date as part of the index name? Is there an option for that or do I have to append it to the name manually?
I'm using the example below from the Java docs, is it possible to print out the json Object as a string for debugging purposes?

				IndexResponse response = client.prepareIndex("test_db", "metrics")
				        .setSource(jsonBuilder()
				                    .startObject()
				                        .field("user", "kimchy")
				                        .field("postDate", new Date())
				                        .field("message", "trying out Elasticsearch")
				                        .field("number", 10)
				                    .endObject()
				                  )
				        .get();

thanks

I added this:

    	DateFormat df = new SimpleDateFormat("yyyy.MM.dd");
    	Date today = Calendar.getInstance().getTime();
    	String indexDate = df.format(today);

        IndexResponse response = client.prepareIndex("test_db-"+indexDate, "metrics")

Have you checked the date math support in index names documentation? I think that might help you...

--Alex