# Join two index ( metricbeat & business )

**URL:** <https://discuss.elastic.co/t/join-two-index-metricbeat-business/285318>\
**Category:** Logstash\
**Created:** [September 28, 2021, 7:33am UTC](https://discuss.elastic.co/t/join-two-index-metricbeat-business/285318 "2021-09-28T07:33:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rodri.gz](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@rodri.gz](https://discuss.elastic.co/u/rodri.gz)\
**Post date:** [September 28, 2021, 7:33am UTC](https://discuss.elastic.co/t/join-two-index-metricbeat-business/285318/1 "2021-09-28T07:33:17Z")

</div>

Hello!

I will explain my case with an example.

I have 2 indexes, one of them is the created by metricbeat and the other is an index that contains business data of my company.

I would like to create a canvas. This canvas will have a selector because both, metricbeat (_host.name_) and the business index (_server_), have a common field with the name of the server.

I would like to have visualizations of metrics and business and that once the server is selected they are painted.

If I put the server field to be called host.name, could it work as if they were just one or do I have to do a join? in case of joining I would like to learn how to do it through logstash with the Elasticsearch filter avoiding the use of kibana.

Thank you so much in advance!

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 28, 2021, 7:34am UTC](https://discuss.elastic.co/t/join-two-index-metricbeat-business/285318/2 "2021-09-28T07:34:08Z")

</div>

Yes you can do this with an Elasticsearch filter, that would be ideal.

---

<div class="post-metadata">

**Author:** ![rodri.gz](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@rodri.gz](https://discuss.elastic.co/u/rodri.gz)\
**Post date:** [September 28, 2021, 7:40am UTC](https://discuss.elastic.co/t/join-two-index-metricbeat-business/285318/3 "2021-09-28T07:40:31Z")

</div>

can you tell how the query must be?

```auto
   elasticsearch {
      hosts => ["es-server"]
      index => "mindex with servers"
      query => "server:%{server} AND host.name:%{host.name}" ????
      fields => { "server" => "new-field-with-server" } ??????
   }

```

I'm a bit confused.  
why should I use a query and not just take the field I want and give it a name as if it were a mutate?

---

<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:** [October 26, 2021, 7:41am UTC](https://discuss.elastic.co/t/join-two-index-metricbeat-business/285318/4 "2021-10-26T07:41:19Z")

</div>

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