title: Random document in ElasticSearch
body: <p>Is there a way to get a truly random sample from an elasticsearch index? i.e. a query that retrieves any document from the index with probability <code>1/N</code> (where <code>N</code> is the number of documents currently indexed)?</p>
  
  <p>And as a follow-up question: if all documents have some numeric field <code>s</code>, is there a way to get a document through weighted random sampling, i.e. where the probability to get document <code>i</code> with value <code>s_i</code> is equal to <code>s_i / sum(s_j for j in index)</code>?</p>