title: dictionary does not give me unique Ids in python
body: <p>I have the output of an elasticsearch query saved in a file. The first few lines looks like this:</p>
  
  <pre><code>{"took": 1,
     "timed_out": false,
     "_shards": {},
     "hits": {
        "total": 27,
        "max_score": 6.5157733,
        "hits": [
           {
              "_index": "dbgap_062617",
              "_type": "dataset",
              ***"_id": "595189d15152c64c3b0adf16"***,
              "_score": 6.5157733,
              "_source": {
                 "dataAcquisition": {
                    "performedBy": "\n\t\tT\n\t\t"
                 },
                 "provenance": {
                    "ingestTime": "201",                     
                 },
                 "studyGroup": [
                    {
                       "Identifier": "1",
                       "name": "Diseas"
                    }
                 ],
                 "license": {
                    "downloadURL": "http",                      
                 },
                 "study": {
                    "alternateIdentifiers": "yes",
                  },
                 "disease": {
                    "name": [
                       "Coronary Artery Disease"
                    ]
                 },
                 "NLP_Fields": {
                    "CellLine": [],
                    "MeshID": [
                       "C0066533",                        
                    ],
                    "DiseaseID": [
                       "C0010068"
                    ],
                    "ChemicalID": [],
                    "Disease": [
                       "coronary artery disease"
                    ],
                    "Chemical": [],
  
                    "Meshterm": [
                       "migen",                        
                    ]
                 },
                 "datasetDistributions": [
                    {
                       "dateReleased": "20150312",                        
                    }
                 ],
                 "dataset": {
                    "citations": [
                       "20032323"
                    ],
                    **"description": "The Precoc.",**                  
                    **"title": "MIGen_ExS: PROCARDIS"**
                 },
                 .... and the list goes on with a bunch of other items ....
  </code></pre>
  
  <p>From all of these nodes I was interested in Unique _Ids, title, and description. So, I created a dictionary and extracted the parts that I was interested in using json. Here is my code:</p>
  
  <pre><code>import json
  s={}
  d=open('local file','w')
  with open('localfile', 'r') as ready:
      for line in ready:
          test=json.loads(line, encoding='utf-8')
          for i in (test['hits']['hits']):
               for x in i:
                    s.setdefault(i['_id'], [i['_source']['dataset']
                    ['description'], i['_source']['dataset']['title']])
          for k, v in s.items():
          d.write(k +'\t'+v[0] +'\t' + v[1] + '\n')
  d.close()
  </code></pre>
  
  <p>Now, when I run it, it gives me a file with duplicated _Ids! Does not dictionary suppose to give me unique _Ids? In my original output file, I have lots of duplicated Ids that I wanted to get rid of them.
  Also, I ran set() only on _ids to get unique number of them and it came to 138. But with dictionary if i remove generated duplicated ids it comes down to 17! 
  Can someone please tell me why this is happening?</p>