Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

apache nifi to elasticsearch convert time to date

avatar
Rising Star

hi all,

I am trying to insert json elastichsearch use apache nifi

{"submit_date": "2017-09-11 12:28:57.0", "request_type": "change", "origin": "monitoring", "description": "Start Event Process from Zabbix", "timestamp":"2018-08-30 08:16:18.970+0000"}

I insert this to elastichsearch, however, elastichsearch can understand submit_date and timestamp is datetime. So, how to insert time to elastichsearch?


Many thanks

1 ACCEPTED SOLUTION

avatar
Super Guru

@Thuy Le

In order for the timestamp to work it has to be in the correct format which elasticsearch expects (default ISO 8601).

Here is a good article about timestamp manipulation in nifi:

https://community.hortonworks.com/questions/113959/use-nifi-to-change-the-format-of-numeric-date-and...

Then in elasticsearch, you need to create a mapping which tells the index which field is the timestamp:

https://www.elastic.co/guide/en/elasticsearch/hadoop/current/mapping.html#mapping-date

https://www.elastic.co/guide/en/elasticsearch/reference/2.0/mapping-date-format.html#built-in-date-f...

If this answer is helpful, please click ACCEPT to mark your question resolved.

View solution in original post

3 REPLIES 3

avatar
Super Guru

@Thuy Le

In order for the timestamp to work it has to be in the correct format which elasticsearch expects (default ISO 8601).

Here is a good article about timestamp manipulation in nifi:

https://community.hortonworks.com/questions/113959/use-nifi-to-change-the-format-of-numeric-date-and...

Then in elasticsearch, you need to create a mapping which tells the index which field is the timestamp:

https://www.elastic.co/guide/en/elasticsearch/hadoop/current/mapping.html#mapping-date

https://www.elastic.co/guide/en/elasticsearch/reference/2.0/mapping-date-format.html#built-in-date-f...

If this answer is helpful, please click ACCEPT to mark your question resolved.

avatar
Rising Star

Hi @Steven Matision,

Thank you so much for your suggestions. I fixed that issue.

avatar
New Member

Can you please share how?