# I have different indexes that contain different fields I need to aggregate all of them, what i mean i have index1 and index2 in index1 I have ch and in index2 I have ch2 how can i add ch to ch2 with script or script field

**URL:** <https://discuss.elastic.co/t/i-have-different-indexes-that-contain-different-fields-i-need-to-aggregate-all-of-them-what-i-mean-i-have-index1-and-index2-in-index1-i-have-ch-and-in-index2-i-have-ch2-how-can-i-add-ch-to-ch2-with-script-or-script-field/341959>\
**Category:** Elasticsearch\
**Created:** [August 30, 2023, 9:05am UTC](https://discuss.elastic.co/t/i-have-different-indexes-that-contain-different-fields-i-need-to-aggregate-all-of-them-what-i-mean-i-have-index1-and-index2-in-index1-i-have-ch-and-in-index2-i-have-ch2-how-can-i-add-ch-to-ch2-with-script-or-script-field/341959 "2023-08-30T09:05:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghramalhajyalhajy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ghramalhajyalhajy/32/125054_2.png) [@ghramalhajyalhajy](https://discuss.elastic.co/u/ghramalhajyalhajy)\
**Post date:** [August 30, 2023, 9:05am UTC](https://discuss.elastic.co/t/i-have-different-indexes-that-contain-different-fields-i-need-to-aggregate-all-of-them-what-i-mean-i-have-index1-and-index2-in-index1-i-have-ch-and-in-index2-i-have-ch2-how-can-i-add-ch-to-ch2-with-script-or-script-field/341959/1 "2023-08-30T09:05:22Z")

</div>

search index  
PUT index1/\_doc/1  
{  
"foo": "bar"  
}  
GET index2/\_search  
{  
"query": {  
"match": {  
"foo": "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:** [September 27, 2023, 9:05am UTC](https://discuss.elastic.co/t/i-have-different-indexes-that-contain-different-fields-i-need-to-aggregate-all-of-them-what-i-mean-i-have-index1-and-index2-in-index1-i-have-ch-and-in-index2-i-have-ch2-how-can-i-add-ch-to-ch2-with-script-or-script-field/341959/2 "2023-09-27T09:05:47Z")

</div>

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