title: How to avoid inserting a duplicate document to ElasticSearch
body: <p>I'm scraping a large set of items using node.js/request and mapping the fields to ElasticSearch documents. The original documents have an ID field which never changes:</p>
  
  <pre><code>{ id: 123456 }
  </code></pre>
  
  <p>Periodically, I'd like to "refresh" and see which original items are no longer available, for whatever reason. Currently, I have a script which scrapes directly and simply inserts into Elastic.</p>
  
  <p>Is there a way to check if an item with the same ID already exists before doing an insert? I don't want to end up with a ton of duplicates.</p>