Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send the data from Kafka to ElasticSearch using python

i am using Python Language. I have csv file, I need to convert into json and send to kafka and then to ElasticSearch.

I am able to convert Csv to Json and send to kafka consumer. How to get the data from Kafka Consumer to ElasticSearch


1 Answers

You don't need to write any Python. Kafka itself provides a streaming integration API, called Kafka Connect. To use it, you just configure it with JSON files.

  • Ingest CSV file into Kafka with https://github.com/jcustenborder/kafka-connect-spooldir
    • Example of it in use: https://www.confluent.io/blog/ksql-in-action-enriching-csv-events-with-data-from-rdbms-into-AWS/
  • Stream data from Kafka topic to Elasticsearch https://www.confluent.io/connector/kafka-connect-elasticsearch/
    • Example of it in use: https://www.confluent.io/blog/blogthe-simplest-useful-kafka-connect-data-pipeline-in-the-world-or-thereabouts-part-2

Disclaimer: I work for Confluent, and wrote the above articles.

like image 119
Robin Moffatt Avatar answered Nov 27 '25 23:11

Robin Moffatt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!