Fielddata and different types with the same field name in index


(Anton Bogdanovich) #1

I have two types (type_a and type_b) in one index and both types have contact_id (long) field.
When I use fielddata stats api (/_cat/fielddata?v&fields=contact_id&pretty), it has only one field named contact_id.
Does this mean that both fields from different types have the same fielddata field?


(Colin Goodheart-Smithe) #2

Yes, different types will share the same underlying field in the index and in field data for fields with the same name. In 2.0 we have implemented stricter mapping rules so that using the same field name across multiple types is less trappy. For more information on those changes take a look at: https://www.elastic.co/blog/great-mapping-refactoring#conflicting-mappings


(Anton Bogdanovich) #3

Thanks for reply.

We have an issue with not working aggregations
(Aggregations stop working silently on elasticsearch 1.4.4)
Could this mapping be an issue (child type field has doc_values: true and parent type does not) ?

           contact: {
              properties: {
                contact_id: { type: 'long', index: 'not_analyzed'}
              }
            },
            event: {
              _parent: { type: :contact },
              properties: {
                user_id: { type: 'long', index: 'not_analyzed' },
                contact_id: { type: 'long', index: 'not_analyzed', doc_values: true },
                data: { type: 'object', index: 'not_analyzed' },
              }
            }

(Colin Goodheart-Smithe) #4

Lets keep the conversation about that issue on that topic to avoid a split conversation in multiple places.


(system) #5