title: Backup and restore some records of an elasticsearch index
body: <p>I wish to take a backup of some records(eg latest 1 million records only) of an Elasticsearch index and restore this backup on a different machine. It would be better if this could be done using available/built-in Elasticsearch features.</p>
  
  <p>I've tried Elasticsearch snapshot and restore (following code), but looks like it takes a backup of the whole index, and not selective records.</p>
  
  <pre><code>    curl -H 'Content-Type: application/json'  -X PUT "localhost:9200/_snapshot/es_data_dump?pretty=true" -d '
      {
        "type": "fs",
        "settings": {
          "compress" : true,
          "location": "es_data_dump"
        }
      }'
  
      curl -H 'Content-Type: application/json'  -X PUT "localhost:9200/_snapshot/es_data_dump/snapshot1?wait_for_completion=true&amp;pretty=true" -d '
      {
        "indices" : "index_name",
        "type": "fs",
        "settings": {
          "compress" : true,
          "location": "es_data_dump"
        }
      }'
  </code></pre>
  
  <p>The format of backup could be anything, as long as it can be successfully restored on a different machine.</p>