Trying to index kafka topic in Elasticsearch with Kafka Connect



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I want to index a topic from kafka in avro to elasticsearch format but
I have problems with my timestamp field to be recognized by
elasticsearch as date format field.



I have used the following configuration for the connector.



 
"name": "es-sink-barchart-10",
"config":
"connector.class": "io.confluent.connect.elasticsearch.ElasticsearchSinkConnector",
"value.converter": "io.confluent.connect.avro.AvroConverter",
"key.converter": "io.confluent.connect.avro.AvroConverter",
"key.converter.schema.registry.url": "http://localhost:8081",
"value.converter.schema.registry.url": "http://localhost:8081",

"connection.url": "http://localhost:9200",

"type.name":"type.name=kafka-connect",

"topics": "exchange_avro_01",

"topic.index.map": "exchange_avro_01:exchange_barchart",

"key.ignore": "true"




The original field is bigint type and I want the target field to be date type with any valid format with elasticsearch. I have defined a dynamic template to try to solve it in the following way:



curl -XPUT "http://localhost:9200/_template/kafkaconnect/" -H 'Content-Type: application/json' -d'

"index_patterns": "exchange*",
"settings":
"number_of_shards": 1,
"number_of_replicas": 0
,
"mappings":
"kafka-connect":
"dynamic_templates": [

"dates":
"match_mapping_type": "long",
"match": "TIME",
"mapping":
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"



]
,
"properties":
"CLOSE":
"type": "double"
,
.
.
.





}'


When I load the connector described above nothing is indexed to elasticsearch.



Any help?










share|improve this question






























    1















    I want to index a topic from kafka in avro to elasticsearch format but
    I have problems with my timestamp field to be recognized by
    elasticsearch as date format field.



    I have used the following configuration for the connector.



     
    "name": "es-sink-barchart-10",
    "config":
    "connector.class": "io.confluent.connect.elasticsearch.ElasticsearchSinkConnector",
    "value.converter": "io.confluent.connect.avro.AvroConverter",
    "key.converter": "io.confluent.connect.avro.AvroConverter",
    "key.converter.schema.registry.url": "http://localhost:8081",
    "value.converter.schema.registry.url": "http://localhost:8081",

    "connection.url": "http://localhost:9200",

    "type.name":"type.name=kafka-connect",

    "topics": "exchange_avro_01",

    "topic.index.map": "exchange_avro_01:exchange_barchart",

    "key.ignore": "true"




    The original field is bigint type and I want the target field to be date type with any valid format with elasticsearch. I have defined a dynamic template to try to solve it in the following way:



    curl -XPUT "http://localhost:9200/_template/kafkaconnect/" -H 'Content-Type: application/json' -d'

    "index_patterns": "exchange*",
    "settings":
    "number_of_shards": 1,
    "number_of_replicas": 0
    ,
    "mappings":
    "kafka-connect":
    "dynamic_templates": [

    "dates":
    "match_mapping_type": "long",
    "match": "TIME",
    "mapping":
    "type": "date",
    "format": "yyyy-MM-dd HH:mm:ss"



    ]
    ,
    "properties":
    "CLOSE":
    "type": "double"
    ,
    .
    .
    .





    }'


    When I load the connector described above nothing is indexed to elasticsearch.



    Any help?










    share|improve this question


























      1












      1








      1








      I want to index a topic from kafka in avro to elasticsearch format but
      I have problems with my timestamp field to be recognized by
      elasticsearch as date format field.



      I have used the following configuration for the connector.



       
      "name": "es-sink-barchart-10",
      "config":
      "connector.class": "io.confluent.connect.elasticsearch.ElasticsearchSinkConnector",
      "value.converter": "io.confluent.connect.avro.AvroConverter",
      "key.converter": "io.confluent.connect.avro.AvroConverter",
      "key.converter.schema.registry.url": "http://localhost:8081",
      "value.converter.schema.registry.url": "http://localhost:8081",

      "connection.url": "http://localhost:9200",

      "type.name":"type.name=kafka-connect",

      "topics": "exchange_avro_01",

      "topic.index.map": "exchange_avro_01:exchange_barchart",

      "key.ignore": "true"




      The original field is bigint type and I want the target field to be date type with any valid format with elasticsearch. I have defined a dynamic template to try to solve it in the following way:



      curl -XPUT "http://localhost:9200/_template/kafkaconnect/" -H 'Content-Type: application/json' -d'

      "index_patterns": "exchange*",
      "settings":
      "number_of_shards": 1,
      "number_of_replicas": 0
      ,
      "mappings":
      "kafka-connect":
      "dynamic_templates": [

      "dates":
      "match_mapping_type": "long",
      "match": "TIME",
      "mapping":
      "type": "date",
      "format": "yyyy-MM-dd HH:mm:ss"



      ]
      ,
      "properties":
      "CLOSE":
      "type": "double"
      ,
      .
      .
      .





      }'


      When I load the connector described above nothing is indexed to elasticsearch.



      Any help?










      share|improve this question
















      I want to index a topic from kafka in avro to elasticsearch format but
      I have problems with my timestamp field to be recognized by
      elasticsearch as date format field.



      I have used the following configuration for the connector.



       
      "name": "es-sink-barchart-10",
      "config":
      "connector.class": "io.confluent.connect.elasticsearch.ElasticsearchSinkConnector",
      "value.converter": "io.confluent.connect.avro.AvroConverter",
      "key.converter": "io.confluent.connect.avro.AvroConverter",
      "key.converter.schema.registry.url": "http://localhost:8081",
      "value.converter.schema.registry.url": "http://localhost:8081",

      "connection.url": "http://localhost:9200",

      "type.name":"type.name=kafka-connect",

      "topics": "exchange_avro_01",

      "topic.index.map": "exchange_avro_01:exchange_barchart",

      "key.ignore": "true"




      The original field is bigint type and I want the target field to be date type with any valid format with elasticsearch. I have defined a dynamic template to try to solve it in the following way:



      curl -XPUT "http://localhost:9200/_template/kafkaconnect/" -H 'Content-Type: application/json' -d'

      "index_patterns": "exchange*",
      "settings":
      "number_of_shards": 1,
      "number_of_replicas": 0
      ,
      "mappings":
      "kafka-connect":
      "dynamic_templates": [

      "dates":
      "match_mapping_type": "long",
      "match": "TIME",
      "mapping":
      "type": "date",
      "format": "yyyy-MM-dd HH:mm:ss"



      ]
      ,
      "properties":
      "CLOSE":
      "type": "double"
      ,
      .
      .
      .





      }'


      When I load the connector described above nothing is indexed to elasticsearch.



      Any help?







      elasticsearch apache-kafka apache-kafka-connect






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 15 '18 at 16:51









      Robin Moffatt

      8,4921530




      8,4921530










      asked Nov 15 '18 at 16:03









      JORGE CARCELLER RUIZJORGE CARCELLER RUIZ

      83




      83






















          1 Answer
          1






          active

          oldest

          votes


















          2














          If your source is a bigint then presumably it's an epoch. If it's an epoch, then this won't work:



          "mapping": 
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"



          because you're telling Elasticsearch that the date format is yyyy-MM-dd HH:mm:ss (which it isn't).



          So instead, try this (omitting your custom mapping for the moment; get this working first and then add that back in):




          "index_patterns": "exchange*",
          "settings":
          "number_of_shards": 1,
          "number_of_replicas": 0
          ,
          "mappings":
          "kafka-connect":
          "dynamic_templates": [

          "dates":
          "match": "TIME",
          "mapping":
          "type": "date"
          ]


          Also ref: https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-field-mapping.html#date-detection




          nothing is indexed to elasticsearch.




          Check the Kafka Connect worker log and the Elasticsearch log for any errors.






          share|improve this answer























          • how can i check kafka connect worker log and elasticsearch log?

            – JORGE CARCELLER RUIZ
            Nov 16 '18 at 11:00











          • Info here on how to check the Connect log. The log for Elasticsearch will be on the stdout if you launch it from the commandline, or in the appropriate log folder if not.

            – Robin Moffatt
            Nov 20 '18 at 11:03











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53323383%2ftrying-to-index-kafka-topic-in-elasticsearch-with-kafka-connect%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          If your source is a bigint then presumably it's an epoch. If it's an epoch, then this won't work:



          "mapping": 
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"



          because you're telling Elasticsearch that the date format is yyyy-MM-dd HH:mm:ss (which it isn't).



          So instead, try this (omitting your custom mapping for the moment; get this working first and then add that back in):




          "index_patterns": "exchange*",
          "settings":
          "number_of_shards": 1,
          "number_of_replicas": 0
          ,
          "mappings":
          "kafka-connect":
          "dynamic_templates": [

          "dates":
          "match": "TIME",
          "mapping":
          "type": "date"
          ]


          Also ref: https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-field-mapping.html#date-detection




          nothing is indexed to elasticsearch.




          Check the Kafka Connect worker log and the Elasticsearch log for any errors.






          share|improve this answer























          • how can i check kafka connect worker log and elasticsearch log?

            – JORGE CARCELLER RUIZ
            Nov 16 '18 at 11:00











          • Info here on how to check the Connect log. The log for Elasticsearch will be on the stdout if you launch it from the commandline, or in the appropriate log folder if not.

            – Robin Moffatt
            Nov 20 '18 at 11:03















          2














          If your source is a bigint then presumably it's an epoch. If it's an epoch, then this won't work:



          "mapping": 
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"



          because you're telling Elasticsearch that the date format is yyyy-MM-dd HH:mm:ss (which it isn't).



          So instead, try this (omitting your custom mapping for the moment; get this working first and then add that back in):




          "index_patterns": "exchange*",
          "settings":
          "number_of_shards": 1,
          "number_of_replicas": 0
          ,
          "mappings":
          "kafka-connect":
          "dynamic_templates": [

          "dates":
          "match": "TIME",
          "mapping":
          "type": "date"
          ]


          Also ref: https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-field-mapping.html#date-detection




          nothing is indexed to elasticsearch.




          Check the Kafka Connect worker log and the Elasticsearch log for any errors.






          share|improve this answer























          • how can i check kafka connect worker log and elasticsearch log?

            – JORGE CARCELLER RUIZ
            Nov 16 '18 at 11:00











          • Info here on how to check the Connect log. The log for Elasticsearch will be on the stdout if you launch it from the commandline, or in the appropriate log folder if not.

            – Robin Moffatt
            Nov 20 '18 at 11:03













          2












          2








          2







          If your source is a bigint then presumably it's an epoch. If it's an epoch, then this won't work:



          "mapping": 
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"



          because you're telling Elasticsearch that the date format is yyyy-MM-dd HH:mm:ss (which it isn't).



          So instead, try this (omitting your custom mapping for the moment; get this working first and then add that back in):




          "index_patterns": "exchange*",
          "settings":
          "number_of_shards": 1,
          "number_of_replicas": 0
          ,
          "mappings":
          "kafka-connect":
          "dynamic_templates": [

          "dates":
          "match": "TIME",
          "mapping":
          "type": "date"
          ]


          Also ref: https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-field-mapping.html#date-detection




          nothing is indexed to elasticsearch.




          Check the Kafka Connect worker log and the Elasticsearch log for any errors.






          share|improve this answer













          If your source is a bigint then presumably it's an epoch. If it's an epoch, then this won't work:



          "mapping": 
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"



          because you're telling Elasticsearch that the date format is yyyy-MM-dd HH:mm:ss (which it isn't).



          So instead, try this (omitting your custom mapping for the moment; get this working first and then add that back in):




          "index_patterns": "exchange*",
          "settings":
          "number_of_shards": 1,
          "number_of_replicas": 0
          ,
          "mappings":
          "kafka-connect":
          "dynamic_templates": [

          "dates":
          "match": "TIME",
          "mapping":
          "type": "date"
          ]


          Also ref: https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-field-mapping.html#date-detection




          nothing is indexed to elasticsearch.




          Check the Kafka Connect worker log and the Elasticsearch log for any errors.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 15 '18 at 17:04









          Robin MoffattRobin Moffatt

          8,4921530




          8,4921530












          • how can i check kafka connect worker log and elasticsearch log?

            – JORGE CARCELLER RUIZ
            Nov 16 '18 at 11:00











          • Info here on how to check the Connect log. The log for Elasticsearch will be on the stdout if you launch it from the commandline, or in the appropriate log folder if not.

            – Robin Moffatt
            Nov 20 '18 at 11:03

















          • how can i check kafka connect worker log and elasticsearch log?

            – JORGE CARCELLER RUIZ
            Nov 16 '18 at 11:00











          • Info here on how to check the Connect log. The log for Elasticsearch will be on the stdout if you launch it from the commandline, or in the appropriate log folder if not.

            – Robin Moffatt
            Nov 20 '18 at 11:03
















          how can i check kafka connect worker log and elasticsearch log?

          – JORGE CARCELLER RUIZ
          Nov 16 '18 at 11:00





          how can i check kafka connect worker log and elasticsearch log?

          – JORGE CARCELLER RUIZ
          Nov 16 '18 at 11:00













          Info here on how to check the Connect log. The log for Elasticsearch will be on the stdout if you launch it from the commandline, or in the appropriate log folder if not.

          – Robin Moffatt
          Nov 20 '18 at 11:03





          Info here on how to check the Connect log. The log for Elasticsearch will be on the stdout if you launch it from the commandline, or in the appropriate log folder if not.

          – Robin Moffatt
          Nov 20 '18 at 11:03



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53323383%2ftrying-to-index-kafka-topic-in-elasticsearch-with-kafka-connect%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Darth Vader #20

          How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

          Ondo