Fields with same name mapped differently in different types

Hey there,

I have one index containing various types. It does happen, that a field with the same name is mapped as string in one type and as integer in another type.

The following query on a type t1, where "sample_field" is mapped as string
{
"query": {
"match_all": {}
},
"facets": {
"stats": {
"statistical": {
"field": "sample_field"
}
}
}
}

results in:
=> FacetPhaseExecutionException[Facet [stats]: field [sample_field] isn't a number field, but a string]
which is of course the expected feedback

The same query a type t2, where "sample_field" is mapped as integer, leads to the following error:
=> NumberFormatException[Invalid shift value in prefixCoded bytes (is encoded value really an INT?)]

I know I could either rename the fields or put the types in different indexes to avoid this error.
I want to keep the mappings as they are.
Is there a more elegant way to solve this issue?

I am using elasticsearch version 0.90.7

Thank you!

I also tried it with
{
"query": {
"match_all": {}
},
"facets": {
"t2.stats": {
"statistical": {
"field": "t2.sample_field"
}
}
}
}
but that results in the same error message.

Unfortunately, no you can't do this at the moment. You'd have to make all
your field types the same, or use different field names. If they are all in
the same index in different types with different data types and same field
names, you'll unfortunately encounter this limitation.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e0c06fab-1cba-4c89-8861-e905f6a8338f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thank you for your answer.
Renaming would create other problems for me, so I went with putting the types in different indexes.