title: ElasticSearch Filtered Aliases Creation - Best Practice
body: <p>We are planning to use Filtered Aliases as mentioned here - <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html" rel="nofollow">https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html</a></p>
  
  <p>Our input data is going to be a stream with each line of the stream corresponding to an object we would like to store in ES. </p>
  
  <p>Each object contains an 'id', which we are using for routing and filtering. </p>
  
  <p>QUESTION - 
  How do we create alias and index data in a performant way ? </p>
  
  <p>-- Do we index all data, keep track of all the unique 'id's and the very end create the filtered alias ? OR </p>
  
  <p>-- For each object, check if an alias for that 'id' exists; if it doesn't create one ?</p>
  
  <p>I'm leaning towards the first approach. Is it advisable and performant when compared to the second approach ? </p>
  
  <p>TIA. </p>