title: Elasticsearch GET just after POST
body: <p>I'm encountering some issues when performing several <code>get_or_create</code> requests to ES.
  Elasticsearch seems to take some time after responding to the <code>POST</code> to index a document, so much that a <code>GET</code> called <strong>just after</strong> returns no results.</p>
  
  <p>This example reproduces the issue:</p>
  
  
  
  <pre class="lang-bash prettyprint-override"><code>curl -XPOST 'http://localhost:9200/twitter/tweet/' -d '{
      "user" : "kimchy",
      "post_date" : "2009-11-15T14:12:12",
      "message" : "trying out Elastic Search"
  }' &amp;&amp; \
  curl -XGET 'http://localhost:9200/twitter/tweet/_search' -d '{
      "query" : {
          "term" : { "user" : "kimchy" }
      }
  }' &amp;&amp; \
  sleep 1 &amp;&amp; \
  curl -XGET 'http://localhost:9200/twitter/tweet/_search' -d '{
      "query" : {
          "term" : { "user" : "kimchy" }
      }
  }'
  </code></pre>
  
  <p>The <code>POST</code> goes well:</p>
  
  <pre class="lang-bash prettyprint-override"><code>{
      "ok": true,
      "_index": "twitter",
      "_type": "tweet",
      "_id": "yaLwtgSuQcWg5lzgFpuqHQ",
      "_version": 1
  }
  </code></pre>
  
  <p>The first <code>GET</code> does not match any result:</p>
  
  <pre class="lang-bash prettyprint-override"><code>{
      "took": 1,
      "timed_out": false,
      "_shards": {
          "total": 5,
          "successful": 5,
          "failed": 0
      },
      "hits": {
          "total": 0,
          "max_score": null,
          "hits": []
      }
  }
  </code></pre>
  
  <p>And after a brief pause, shows the result (second <code>GET</code>):</p>
  
  <pre class="lang-bash prettyprint-override"><code>{
      "took": 1,
      "timed_out": false,
      "_shards": {
          "total": 5,
          "successful": 5,
          "failed": 0
      },
      "hits": {
          "total": 1,
          "max_score": 0.30685282,
          "hits": [{
              "_index": "twitter",
              "_type": "tweet",
              "_id": "yaLwtgSuQcWg5lzgFpuqHQ",
              "_score": 0.30685282,
              "_source": {
                  "user": "kimchy",
                  "post_date": "2009-11-15T14:12:12",
                  "message": "trying out Elastic Search"
              }
          }]
      }
  }
  </code></pre>
  
  <p>Is that behaviour normal ?</p>
  
  <p>Is there a possibility to get the result immediately, even if the response is slower ?</p>
  
  <p>Thanks!</p>