# "field existed as two different types" when empty index included in alias

**URL:** <https://discuss.elastic.co/t/field-existed-as-two-different-types-when-empty-index-included-in-alias/172239>\
**Category:** Elasticsearch\
**Created:** [March 14, 2019, 3:20am UTC](https://discuss.elastic.co/t/field-existed-as-two-different-types-when-empty-index-included-in-alias/172239 "2019-03-14T03:20:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Colin\_Bankier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colin_bankier/32/41946_2.png) [@Colin\_Bankier](https://discuss.elastic.co/u/Colin_Bankier)\
**Post date:** [March 14, 2019, 3:20am UTC](https://discuss.elastic.co/t/field-existed-as-two-different-types-when-empty-index-included-in-alias/172239/1 "2019-03-14T03:20:21Z")

</div>

I'm seeing some behaviour that seemed unexpected, and wanted clarify whether it is indeed intended / expected, or is a known issue.

ES version 6.5.1

I have a query against an alias which includes 3 indices. For the field in question (groupID), it is a long in 2 of the indices, and the 3rd index has no documents (and dynamic mapping, so no mapping for groupID at all).  
The query includes the aggregation:

```
"aggregations": {
	"groupID": {
		"terms": {
			"field": "groupID",
	                "missing": -1,
...
}}

```

Which fails with

> aggregations failed when computing the aggregation [groupID] because the field you gave in the aggregation query existed as two different types in two different indices

I can confirm there no two different types - just an index with no data and no types.  
If I remove the empty index from the alias, the query succeeds.  
If I remove the "missing": -1 from the aggregation, the query succeeds.

Is this behaviour expected?

---

<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 11, 2019, 3:20am UTC](https://discuss.elastic.co/t/field-existed-as-two-different-types-when-empty-index-included-in-alias/172239/2 "2019-04-11T03:20:24Z")

</div>

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