title: How to Design Searching Users and Friends using ElasticSearch?
body: <p>In our app, we have users and users can have friends (think Facebook, relationship is bi-directional). We would like to be able to:</p>
  
  <ol>
  <li><p>Have a site-wide search for users by name or username</p></li>
  <li><p>Allow each user to search her friends by name or username</p></li>
  </ol>
  
  <p>What would be the best approach to design this keeping in mind that:</p>
  
  <ol>
  <li><p>A user can have up to 50k friends.</p></li>
  <li><p>Users can change their names and usernames all the time</p></li>
  </ol>