Date type changed to text after upgrading from elastic and kiban 6.4.1 to 7.8.0

I have developed a java springboot batch that collect data from middleware logs and insert it to elastic index, the index is created by the batch with some fields that have date type (datein, dateout...).
After upgrading from ELK 6.4.1 and 7.8.0, the "date" type fields became "text" type in kibana so I can't filter these fields by date.
How can I get back the date fields so I can filter by date in kibana, please.
Here's the code creation of the index in java:

public void createIndexProxy(String typeLog) throws InterruptedException,
			ExecutionException, IOException {"############ création de l'index: " + typeLog);

		client.admin().indices().create(new CreateIndexRequest(typeLog))
		CreateIndexRequest request = new CreateIndexRequest(typeLog);
						.startObject("service").field("type", "keyword").field("index", "true").endObject()
						.startObject("uc").field("type", "text").endObject()
						.startObject("thread").field("type", "text").endObject()
						.startObject("adresseIp").field("type", "text").endObject()
						.startObject("dateIn").field("type", "date").field("format", "dd/MM/yyyy HH:mm:ss").endObject()
						.startObject("dateOut").field("type", "date").field("format", "dd/MM/yyyy HH:mm:ss").endObject()
						.startObject("requestTime").field("type", "integer").endObject()
						.startObject("fluxIn").field("type", "text").endObject()
						.startObject("fluxOut").field("type", "text").endObject()
						.startObject("exception").field("type", "text").endObject()
						.startObject("serviceTime").field("type", "integer").endObject()
						.startObject("serviceResponseLength").field("type", "integer").endObject()
						.startObject("timestamp").field("type", "long").endObject()
						.startObject("synchStatus").field("type", "text").field("index", "true").endObject()
						.startObject("utilisateur").field("type", "text").endObject()
						.endObject().endObject().endObject()), XContentType.JSON)

       ActionFuture<CreateIndexResponse> actionFuture = client.admin().indices().create(request);"############ l'index " + typeLog + " a été créé");

thanks for your help.

Hi, the mapping of fields to their data types is controlled by Elasticsearch. Check the mapping of your index to see how the data will be interpreted by Kibana. See Get mapping API | Elasticsearch Guide [7.8] | Elastic

It's most likely that your Java program needs to set a mapping for the data in index settings. See Create Index API | Java REST Client [7.13] | Elastic

thanks for your feedback
the problem was with the date format, ES 7.8 accept this format only "yyyy/MM/dd HH:mm:ss".

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