# Specify field over multiple indices

**URL:** <https://discuss.elastic.co/t/specify-field-over-multiple-indices/49763>\
**Category:** Elasticsearch\
**Created:** [May 11, 2016, 12:59pm UTC](https://discuss.elastic.co/t/specify-field-over-multiple-indices/49763 "2016-05-11T12:59:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kucera.jan.cz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kucera.jan.cz/32/5869_2.png) [@kucera.jan.cz](https://discuss.elastic.co/u/kucera.jan.cz)\
**Post date:** [May 11, 2016, 12:59pm UTC](https://discuss.elastic.co/t/specify-field-over-multiple-indices/49763/1 "2016-05-11T12:59:04Z")

</div>

Hello everyone,

we are using multiple indices query (to simulate join over aliased indices) and aggregation and we ran into an issue with same field names. Let me describe on example:  
`PUT /A/data/1 { "key": "KEY_A", "count" : 1 } PUT /A/data/2 { "key": "KEY_A", "count" : 1 } PUT /B/data/1 { "key": "KEY_A", "count" : 4, "text" : "HELLO" }`

`GET A,B/_search { "size": 0, "aggs": { "KEY_AGG" : { "terms": { "field": "key" }, "aggs": { "SUM_COUNT": { "sum": { "field": "count" } }, "FIRST_B_TEXT" : { "terms": { "field": "text", "size": 1 } } } } } }`

Unfortunately I need to sum only from index A (therefore get SUM: 2 instead of 6), but it takes field `count` from both indices. Is there any way to specify only index A? Something like: `"field": "A.count"`? Please note that A and B are actually aliases, however I hope that it's not that important..

Thanks in advance  
Jan

---

<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:** [May 12, 2016, 12:26am UTC](https://discuss.elastic.co/t/specify-field-over-multiple-indices/49763/2 "2016-05-12T00:26:01Z")

</div>

> [@kucera.jan.cz](#):
>
> Is there any way to specify only index A?

The only way to do that would be to only query that index.

---

<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:** [July 5, 2017, 10:52pm UTC](https://discuss.elastic.co/t/specify-field-over-multiple-indices/49763/3 "2017-07-05T22:52:20Z")

</div>


