title: How to deal with Elasticsearch index delay
body: <p>Here's my scenario:</p>
  
  <p>I have a page that contains a list of users. I create a new user through my web interface and save it to the server. The server indexes the document in elasticsearch and returns successfully. I am then redirected to the list page which doesn't contain the new user because it can take up to 1-second for documents to become available for search in elasticsearch </p>
  
  <p><a href="https://www.elastic.co/guide/en/elasticsearch/guide/current/near-real-time.html">Near real-time search in elasticsearch</a>.</p>
  
  <p>The elasticsearch guide says you can manually refresh the index, but says not to do it in production.</p>
  
  <blockquote>
    <p>...don’t do a manual refresh every time you index a document in production; it will hurt your performance. Instead, your application needs to be aware of the near real-time nature of Elasticsearch and make allowances for it.</p>
  </blockquote>
  
  <p>I'm wondering how other people get around this? I wish there was an event or something I could listen for that would tell me when the document was available for search but there doesn't appear to be anything like that. Simply waiting for 1-second is plausible but it seems like a bad idea because it presumably could take much less time than that.</p>
  
  <p>Thanks!</p>