How to add timestamp and search old data

  1. How to add current timestamp while indexing the data.

     public class GetTestSuiteXML {
     	String path = "resources/b6f1-testsuite.xml";
     	int testcaseCount = 0;
     	int idCount = 1;
     	Map<String,String> map = new HashMap<String, String>();
     	public void getTestSuiteDetail() throws IOException  {
     		RestHighLevelClient client = new RestHighLevelClient(
                     RestClient.builder(new HttpHost("localhost", 9200, "http"))
                         .setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
                             public RequestConfig.Builder customizeRequestConfig(RequestConfig.Builder requestConfigBuilder) {
                                 return requestConfigBuilder.setConnectTimeout(5000)
     		DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
     		try {
     			DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
     			Document xmlDocument = docBuilder.parse(new File(path));
     			XPath xPath = XPathFactory.newInstance().newXPath();
     			String expression = "/test-suite/name";			
     			XPathExpression expr = xPath.compile("/test-suite/name");		
     			String testSuiteName = (String) expr.evaluate(xmlDocument, XPathConstants.STRING);
     			map.put("testsuitename", testSuiteName);

In the above code, How to define/add current timestamp while indexing.

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