How to set TimeStamp from java?


i am using the elasticsearch-java-Client:


and connected to a Elastic-Server. Puting documents (we want to log from java) into ES works:

Logentry3 log = new Logentry3.Builder(message, level, this.anwendungsID, this.sessionID).addAll(optionale_Daten).build();
Request request = new Request("POST", indexname);
ObjectMapper mapper = new ObjectMapper(); // Jackson Json
Response response = ct.restClient.performRequest(request);

ct is just a custom class from us where the connection is done and saved.
Logentry3 is a custom class from us to hold:
String message, log_level status, int anwendungsID, int sessionID and a HashMap<String, Object>() optional_data

Now we want to add time to allow kibana to display Dashboards within a specified begin and endtime. The system.currenttimeMillis() seems not to work for that.

Which Java-class do we need so save within the document?



I think (but don't know for sure) that while creating a data view on Kibana -> Stack Management -> Data views
i should be able to choose a Timestamp field if i did everything right.
Currently i can not.



This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.