title: Single index multi type - elasticsearch indexing via tire
body: <p>In my multi-tenant app (account based with number of users per account), how would I update index for a particular account when a user document is changed.</p>
  
  <p>I have a separate index for each account, in which the mappings for each model (user and comments - just an example actual app has many models) are specified. In this case if any change has been done for user model or comment model, the index that has been created for the related account has to be updated. Is this possible? Please let me know if yes.</p>
  
  <p>I guess this is the way I specify the mappings in my case. Correct me if I'm wrong.</p>
  
  <p><strong>Account Model:</strong></p>
  
  <pre><code>include Tire::Model::Search
  
  Tire.index('account_1') do
    create(
      :mappings =&gt; {
        :user =&gt; {
          :properties =&gt; {
            :name =&gt; { :type =&gt; :string, :boost =&gt; 10 },
            :company_name =&gt; { :type =&gt; :string, :boost =&gt; 5 }
          }
        },
        :comments =&gt; {
          :properties =&gt; {
            :description =&gt; { :type =&gt; :string, :boost =&gt; 5 }
          }
        }
      }
    )
  end
  </code></pre>
  
  <p>The index is getting created correctly with both the mappings for account index. But, I don't see a way where I can update the index when any model specified in the mappings are changed.</p>
  
  <p>Whenever a new user is added or if an user is updated the index created for the corresponding account has to be updated.</p>