# Merge 2 or more text files data to same index

**URL:** <https://discuss.elastic.co/t/merge-2-or-more-text-files-data-to-same-index/171969>\
**Category:** Logstash\
**Created:** [March 12, 2019, 2:11pm UTC](https://discuss.elastic.co/t/merge-2-or-more-text-files-data-to-same-index/171969 "2019-03-12T14:11:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaTheDev](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@RaTheDev](https://discuss.elastic.co/u/RaTheDev)\
**Post date:** [March 12, 2019, 2:11pm UTC](https://discuss.elastic.co/t/merge-2-or-more-text-files-data-to-same-index/171969/1 "2019-03-12T14:11:10Z")

</div>

Wondering how to merge the data from below files to same index, as I receive these files at different intervals.  
One common thing with in these files is the student ID which is primary Key

File A: (Student Grades)  
StudentID|StudentName|StudentGrade  
P0172069|StuLast1|A  
P0172369|StuLast2|A+  
P0172269|StuLast3|B  
P0172169|StuLast4|C

File B: (Student Attendance)  
StudentID|Student Attendance | Expected Attendance |  
P0172069|45 |70  
P0172369|55|70  
P0172269|72|70  
P0172169|65|70

File C: (Student Majors)  
StudentID|Subject 1 | Subject 2  
P0172069|Maths |Maths  
P0172369|Science |Physics  
P0172269|Biology|Anatomy  
P0172169|Computers|Software Engineering

**Expected Output:**  
{  
StudentID: P0172069  
StudentName: StuLast1  
StudentGrade: A  
Student Attendance : 45  
Expected Attendance: 70  
Subject 1 : Maths  
Subject 2 : Maths

StudentID: P0172369  
StudentName: StuLast2  
StudentGrade: A+  
Student Attendance : 55  
Expected Attendance: 70  
Subject 1 : Science  
Subject 2 : Physics  
......  
}

---

<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:** [March 12, 2019, 3:03pm UTC](https://discuss.elastic.co/t/merge-2-or-more-text-files-data-to-same-index/171969/2 "2019-03-12T15:03:56Z")

</div>

You could try [this](https://discuss.elastic.co/t/aggregate-problem/142572/7?u=badger).

---

<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 9, 2019, 3:07pm UTC](https://discuss.elastic.co/t/merge-2-or-more-text-files-data-to-same-index/171969/3 "2019-04-09T15:07:37Z")

</div>

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