Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8981623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:22:59+00:00 2026-06-15T20:22:59+00:00

I am using Tire and elasticsearch to provide search functionality on a MongoMapper model,

  • 0

I am using Tire and elasticsearch to provide search functionality on a MongoMapper model, which is part of a Rails App. I just stumbled across a problem where the mappings for this model were not being updated when I redeployed to an environment that uses the following configuration (in config/environments/env_name.rb):

config.cache_classes = true

reloading the class alone didn’t seem to fix the issue (perhaps understandably, the new mappings might not be incompatible with existing data I guess?). instead I had to do the following:

MyModel.index.delete
<restart the app or reload the class>
MyModel.index.import MyModel.all

I just wondered if there’s a better way of a). ensuring the latest mappings defined in my model code are being used by elasticsearch after each deployment but b). avoiding unnecessary repopulating the index with the complete dataset?

We normally deploy using Chef, so I could automate the three steps I used successfully without too much trouble. But I’m new to elasticsearch and tire so I thought it’s highly likely I’m misusing both or making things unnecessarily difficult.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:23:00+00:00Added an answer on June 15, 2026 at 8:23 pm

    Couple of points here:

    • Tire tries to create the index with correct mapping when the class loads
    • but Tire does not attempt to create the index for the model when it already exists

    So, your question is really more about the proper workflow? When you deploy a new version of the application, you shouldn’t re-populate the index, in the same way you don’t re-populate the database from some kind of backup.

    Automatically checking for index mappings conforming to current definition in the model is certainly possible (compare the MyModel.tire.index.mapping with MyModel.tire.mapping, re-populate if different, etc), it’s something I’d be wary to do.

    The developer usually knows when she changed the mapping and should re-index the data. Dropping the index, and re-populating also means search downtime, and isn’t even feasible for large applications.

    A nicer solution is to use a specific index name such as my-index-2012-12 when importing the data, and point a my-index alias to this index. Then you can freely re-populate the index, and flip the alias when you’re done, without downtime. Tire tries hard to support you in this kind of workflow (the Rake import task, etc).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using ElasticSearch along with the tire gem to power the search functionality of
Using Tire.gem to search Im unable to find the correct part of documentation on
I'm using ElasticSearch and tire.rb to index and search my collection of items. I
I'm using ElasticSearch with Tire to index and search some ActiveRecord models, and I've
I am using tire-0.4.2 to interact with elasticsearch in my rails application (uses mongodb
Using elasticsearch and Tire im trying to search a few profile records. Try to
Using Elasticsearch with Rails 3 and tire gem. I have got facets to work
I am using a few persisted Tire models in my Rails app. Searching has
I'm having trouble getting Tire working using ElasticSearch with the Bonsai addon on the
I’m working on an application which has been designed using n-tire application architecture .The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.