Hi,

I'm using below code to insert some documents in elasticsearch index. But 
when inserting in the es the time is coming as UTC format rather than 
original GMT+5:30Z format. Where as the Sysout before indexing is giving me 
correct format as  *2014-08-11T18:23:13.447+05:30* . Please let me know how 
to keep the orizinal time format.

public static IndexResponse addDocumentsQuota(Client client, String index,
String type, String categoryName) {

 IndexResponse indexResponse = null;
 DateTime date = new DateTime();
 System.out.println(date);
 try {
indexResponse = client.prepareIndex(index, type)
 .setSource(jsonBuilder()
    .startObject()
    .field("@timestamp", date)
    .field("category_name", categoryName)
    .field("alert_message", "alert message")
    .field("creation_time", date)
    .endObject())
    .execute()
    .actionGet();
} catch (ElasticsearchException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} 
return indexResponse;
}

   *After indexing:*

"_source": {
               "@timestamp": "2014-08-11T11:57:59.839Z",
               "category_name": "newCat1",
               "alert_message": "alert message",
               "creation_time": "2014-08-11T11:57:59.852Z"
            }

Thanks,
Subhadip

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/5c82c9ab-a627-46a9-ad18-dda334524ab1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to