title: Import list of dicts or JSON file to elastic search with python
body: <p>I have a <code>.json.gz</code> file that I wish to load into elastic search. </p>
  
  <p>My first attempt involved using the <code>json</code> module to convert the JSON to a list of dicts.</p>
  
  <pre><code>import gzip
  import json
  from pprint import pprint
  from elasticsearch import Elasticsearch
  
  nodes_f = gzip.open("nodes.json.gz")
  nodes = json.load(nodes_f)
  </code></pre>
  
  <p>Dict example:</p>
  
  <pre><code>pprint(nodes[0])
  
  {u'index': 1,
   u'point': [508163.122, 195316.627],
   u'tax': u'fehwj39099'}
  </code></pre>
  
  <p>Using Elasticsearch:</p>
  
  <pre><code>es = Elasticsearch()
  
  data = es.bulk(index="index",body=nodes)
  </code></pre>
  
  <p>However, this returns:</p>
  
  <pre><code>elasticsearch.exceptions.RequestError: TransportError(400, u'illegal_argument_exception', u'Malformed action/metadata line [1], expected START_OBJECT or END_OBJECT but found [VALUE_STRING]')
  </code></pre>
  
  <p>Beyond this, I wish to be able to find the <code>tax</code> for given <code>point</code> query, in case this has an impact on how I should be indexing the data with elasticsearch.</p>