# When i am searching in ES index, i am getting 2 or 3 multiple records. I want those results as a single record

**URL:** https://discuss.elastic.co/t/when-i-am-searching-in-es-index-i-am-getting-2-or-3-multiple-records-i-want-those-results-as-a-single-record/221363
**Category:** Elasticsearch
**Created:** [February 28, 2020, 4:41am UTC](https://discuss.elastic.co/t/when-i-am-searching-in-es-index-i-am-getting-2-or-3-multiple-records-i-want-those-results-as-a-single-record/221363 "2020-02-28T04:41:58Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![pyerunka](https://avatars.discourse-cdn.com/v4/letter/p/d6d6ee/32.png) [@pyerunka](https://discuss.elastic.co/u/pyerunka)
#### Post date: [February 28, 2020, 4:41am UTC](https://discuss.elastic.co/t/when-i-am-searching-in-es-index-i-am-getting-2-or-3-multiple-records-i-want-those-results-as-a-single-record/221363/1 "2020-02-28T04:41:58Z")

</div>

Hello,

I am using jdbc input plugin to fetch data from database.  
I have created ES index using 6 different sql queries and in that 6 queries some columns are same.  
After that i have created one index pattern in endeca.  
when i have searched value from same column then it is giving me 6 different results from 6 different queries.  
I want to show them as a one record.  
How I can achieve this?

for example,  
I have two tables: Test\_tb and Result\_tb  
in Test\_tb, I have 3 columns, contentid, title and object\_summary  
and in Result\_tb, i have 3 columns contentid, segment\_name and helpdesk\_name.

So when i am searching contentid 1234. Contentid 1234 is present in both the tables. In this case it is giving me results as 2. Because contentid 1234 is matching in 2 tables.  
But my requirement is to show those 2 records as a one record with contentid as common record.

Regards,  
Priyanka

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [February 28, 2020, 2:56pm UTC](https://discuss.elastic.co/t/when-i-am-searching-in-es-index-i-am-getting-2-or-3-multiple-records-i-want-those-results-as-a-single-record/221363/2 "2020-02-28T14:56:15Z")

</div>

So you want to "join" 2 documents to be only one.

You should solve that problem at index time and index only one single document.

---

<div class="post-metadata">

### Author: ![pyerunka](https://avatars.discourse-cdn.com/v4/letter/p/d6d6ee/32.png) [@pyerunka](https://discuss.elastic.co/u/pyerunka)
#### Post date: [March 2, 2020, 4:04am UTC](https://discuss.elastic.co/t/when-i-am-searching-in-es-index-i-am-getting-2-or-3-multiple-records-i-want-those-results-as-a-single-record/221363/3 "2020-03-02T04:04:43Z")

</div>

Hello @dadoonet,

How to index only one single document at index time?

Regards,  
Priyanka

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [March 10, 2020, 10:21am UTC](https://discuss.elastic.co/t/when-i-am-searching-in-es-index-i-am-getting-2-or-3-multiple-records-i-want-those-results-as-a-single-record/221363/4 "2020-03-10T10:21:37Z")

</div>

Instead of sending:

```auto
PUT index/_doc/test_12345
{
  "contentid": "12345", 
  "title": "foo",
  "object_summary": "bar"
}
PUT index/_doc/result_12345
{
  "contentid": "12345", 
  "segment_name": "foo",
  "helpdesk_name": "bar"
}

```

You can send:

```auto
PUT index/_doc/12345
{
  "contentid": "12345",
  "test": { 
    "title": "foo",
    "object_summary": "bar"
  },
  "result": {
    "segment_name": "foo",
    "helpdesk_name": "bar"
  }
}

```

---

<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: [April 7, 2020, 10:23am UTC](https://discuss.elastic.co/t/when-i-am-searching-in-es-index-i-am-getting-2-or-3-multiple-records-i-want-those-results-as-a-single-record/221363/5 "2020-04-07T10:23:50Z")

</div>

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