title: How to remove duplicate search result in elasticsearch?
body: <p>First Create some example data (e1,e2,e3 are types and test is the index name):</p>
  
  <pre><code>PUT test/e1/1
  {
    "id":1
    "subject": "subject 1"
  }
  PUT test/e2/1
  {
    "id":1
    "subject": "subject 2"
  }
  PUT test/e3/2
  {
    "id":2
    "subject": "subject 3"
  }
  </code></pre>
  
  <p>Now my question is: how can I get just these two data? remove duplicate data with the same id in the <code>curl -XGET _search</code> result.</p>
  
  <pre><code>test/e1/1
  {
    "id":1
    "subject": "subject 1"
  }
  test/e3/2
  {
    "id":2
    "subject": "subject 3"
  }
  </code></pre>