Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

apache nifi to elasticsearch convert time to date

Solved Go to solution
Highlighted

apache nifi to elasticsearch convert time to date

New Contributor

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

Accepted Solutions

Re: apache nifi to elasticsearch convert time to date

Super Collaborator

@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.

3 REPLIES 3

Re: apache nifi to elasticsearch convert time to date

Super Collaborator

@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.

Re: apache nifi to elasticsearch convert time to date

New Contributor

Hi @Steven Matision,

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

Re: apache nifi to elasticsearch convert time to date

New Contributor

Can you please share how?

Don't have an account?
Coming from Hortonworks? Activate your account here