karmi/tire — Issue #187: Index creation fails
Author: zirni
Created: 2011-12-27 10:18:03+00:00
State: open

Hello,

we've got a different behavior when it comes to index creation.
Explicitly index creation ends in a different index schema.
class User
tire.mapping do
indexes :id, :type => 'integer'
indexes :first_name, :type => 'string'
indexes :last_name, :type => 'string'
indexes :company, :type => 'string'
indexes :street, :type => 'string'
indexes :zip, :type => 'string'
indexes :city, :type => 'string'
indexes :country, :type => 'string'
indexes :phone, :type => 'string'
indexes :email, :type => 'string', :index => :not_analyzed
indexes :created_at, :type => 'date'
indexes :accepted_terms, :type => 'string'
indexes :points, :type => 'integer'
end
end

With User.index.create we get the following index schema

{
state: open
settings: {
index.number_of_shards: 5
index.number_of_replicas: 1
}
mappings: { }
aliases: [ ]
}

We get an empty mapping.

If i just start rails c and the index doesnt exist, the index will be created with the
correct mapping.

{
state: open
settings: {
index.number_of_shards: 5
index.number_of_replicas: 1
}
mappings: {
user: {
properties: {
zip: {
type: string
}
phone: {
type: string
}
street: {
type: string
}
city: {
type: string
}
country: {
type: string
}
id: {
type: integer
}
first_name: {
type: string
}
email: {
index: not_analyzed
type: string
}
company: {
type: string
}
last_name: {
type: string
}
created_at: {
format: dateOptionalTime
type: date
}
accepted_terms: {
type: string
}
points: {
type: integer
}
}
}
}
aliases: [ ]
}

Any ideas?

Thanks and best regards,
zirni