3

Scenario

I have a simple POJO which is basically going to be used as a template for my indexed document.this POJO contains field createdTimestamp of type java.util.Date

I am using TransportClient for talking to ES cluster. the same client object is creating the index and indexing the bean as an elasticsearch document. The POJO is first converted to a json and then fed to client.prepareIndex() method

Kibana is used to analyse the indexes.

Problem :

the json contains the createdTimestamp as "Mar 20, 2017 4:39:39 PM" But as soon as its indexed it is converted to EPOC time(long number) , which is not eligible for timestamp based analysis on kibana.

All i want is to have a way to configure a field in the POJO before indexing to ES so that it could be used same as @timestamp field in Logstash indexes.

I came across a class TimestampFieldMapper in elasticsearch library but could not find a way of using it.

Using ES 5.2.2 , kibana 5.2.2 , Transport Client 5.2.2

0 Answers0