# How to pull data data from 2 kafka topics using logstash and index the data in two separate index in elasticsearch

**URL:** <https://discuss.elastic.co/t/how-to-pull-data-data-from-2-kafka-topics-using-logstash-and-index-the-data-in-two-separate-index-in-elasticsearch/114977>\
**Category:** Logstash\
**Created:** [January 10, 2018, 11:24pm UTC](https://discuss.elastic.co/t/how-to-pull-data-data-from-2-kafka-topics-using-logstash-and-index-the-data-in-two-separate-index-in-elasticsearch/114977 "2018-01-10T23:24:40Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![kamalbeg](https://avatars.discourse-cdn.com/v4/letter/k/aca169/32.png) [@kamalbeg](https://discuss.elastic.co/u/kamalbeg)\
**Post date:** [January 10, 2018, 11:24pm UTC](https://discuss.elastic.co/t/how-to-pull-data-data-from-2-kafka-topics-using-logstash-and-index-the-data-in-two-separate-index-in-elasticsearch/114977/1 "2018-01-10T23:24:40Z")

</div>

I have a question regarding Kafka. I have create two topics called first\_topic and second\_topic

I have a logstash-kafka.conf file

input {  
kafka {  
bootstrap\_servers =\> "servera:9092"  
topics =\> ["first\_topic"]  
}  
}

output {  
elasticsearch {  
hosts =\> ["elasticA:9200"]  
index =\> "logstash-nco"  
}

and I get the data fine in elasticsearch.

how can I pull the data from second\_topic and insert into logstash-tiv index in elasticsearch? Do I have to create to separate conf file? or can I add the logic into the existing logstash-kafka.conf file? Please tell mehow can I pull the data from 2 separate topic and insert into 2 separate index using the same config file logstash-kafka.conf?

---

_[View the full topic](https://discuss.elastic.co/t/how-to-pull-data-data-from-2-kafka-topics-using-logstash-and-index-the-data-in-two-separate-index-in-elasticsearch/114977)._
