# One kafka topic data is pushing to all elasticsearh

**URL:** <https://discuss.elastic.co/t/one-kafka-topic-data-is-pushing-to-all-elasticsearh/203591>\
**Category:** Logstash\
**Created:** [October 15, 2019, 8:42am UTC](https://discuss.elastic.co/t/one-kafka-topic-data-is-pushing-to-all-elasticsearh/203591 "2019-10-15T08:42:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaychaudhary](https://avatars.discourse-cdn.com/v4/letter/j/a8b319/32.png) [@jaychaudhary](https://discuss.elastic.co/u/jaychaudhary)\
**Post date:** [October 15, 2019, 8:42am UTC](https://discuss.elastic.co/t/one-kafka-topic-data-is-pushing-to-all-elasticsearh/203591/1 "2019-10-15T08:42:22Z")

</div>

Hello All,  
I am facing one problem with kafka logstash plugin, I have two kafka topic (ie. Topic-1, topic-2) and two indexes on Elasticsearch (ie. Index-1, index-2). I want to send topic-1 data to index-1 and topic-2 data to index-2.  
For that I have written 2 conf file, placed them in single directory and make a pipeline for that directory.

When there is any data comes to topic-1, this data is sends to both the indexes instead of index-1 only.  
Below is my logstash conf file:

_input {_  
_kafka {_  
_consumer\_threads =\> 1_  
_topics =\> "room"_  
_bootstrap\_servers =\>"localhost:9092"_  
_group\_id =\> "room"_  
_codec =\> "json"_  
_decorate\_events =\> true_  
_}_  
_}_

_output {_  
_elasticsearch {_  
_hosts =\> "localhost:9200"_  
_index =\> "room"_  
_document\_type =\> "\_doc"_  
_workers =\> 1_

_}_  
_stdout { codec =\> rubydebug }_  
_}_

Second Config file:

_input {_  
_kafka {_  
_consumer\_threads =\> 1_  
_topics =\> "student"_  
_bootstrap\_servers =\>"localhost:9092"_  
_group\_id =\> "student"_  
_codec =\> "json"_  
_decorate\_events =\> true_  
_}_  
_}_

_output {_  
_elasticsearch {_  
_hosts =\> "localhost:9200"_  
_index =\> "student"_  
_document\_type =\> "\_doc"_  
_workers =\> 1_

_}_  
_stdout { codec =\> rubydebug }_  
_}_

I want to send each topic data to related single index only.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [October 15, 2019, 2:24pm UTC](https://discuss.elastic.co/t/one-kafka-topic-data-is-pushing-to-all-elasticsearh/203591/2 "2019-10-15T14:24:33Z")

</div>

> [@jaychaudhary](#):
>
> When there is any data comes to topic-1, this data is sends to both the indexes instead of index-1 only.

That is the expected behaviour of you point path.config to a directory that contains two configuration files. Set up two pipelines, with each one pointed to one of the configuration files.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 12, 2019, 2:25pm UTC](https://discuss.elastic.co/t/one-kafka-topic-data-is-pushing-to-all-elasticsearh/203591/3 "2019-11-12T14:25:03Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
