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

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?

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