karmi/tire — Issue #271: _type mangling on record after #update_index
Author: demersus
Created: 2012-03-09 18:25:21+00:00
State: open

I am using Mongoid as my ODM. I am also using single collection inheritance. Tire wants to put all of my sub classes into the same elastic search type.

Example:
I have a class type of Foo,
When I have a sub class of Bar, tire wants to put all 'bars' in elastic search as 'foos'.

I noticed a method named .document_type, which will allow me to change what elastic search '_type' I want. In my 'Bar' model I do this:

document_type 'bar'

If I call '#update_index' on my bar model, it will set the actual _type field on my mongoid instance to 'bar'. It should be 'Foo::Bar'. If I save my model afterwards to the database, it will save the _type field as 'bar'. Is this the intended behavior of '.document_type' ?