title: Error in BulkRequest java API in Elasticsearch : "The number of object passed must be even but was [1]"
body: <p>I am trying to use map with Bulk Insert Api of ElasticSearch Java Api</p>
  
  <pre><code>public  void bulkInsert(List&lt;Map&lt;String,String&gt;&gt; listOfObjects ){
  
      BulkRequestBuilder bulkRequest = client.prepareBulk();
  
      Iterator&lt;Map&lt;String,String&gt;&gt; itr = listOfObjects.iterator();
  
      if (itr.hasNext()){
          Map&lt;String,String&gt; document = itr.next();
          bulkRequest.add(client.prepareIndex(index, type)
                  .setSource(document));
      }
  
      BulkResponse bulkResponse = bulkRequest.execute().actionGet();
  
  
      if (bulkResponse.hasFailures()) {
          System.out.println(bulkResponse.buildFailureMessage());
      }   
  
  }
  </code></pre>
  
  <p>And I am calling this with</p>
  
  <pre><code>Map&lt;String,String&gt; jsonMap = new HashMap&lt;String,String&gt;();
  
      jsonMap.put("name", fullName.toString());
      jsonMap.put("file", file);
  
      List&lt;Map&lt;String,String&gt;&gt; listOfObjects = new ArrayList&lt;Map&lt;String,String&gt;&gt;();
      listOfObjects.add(jsonMap);
      indexService.bulkInsert(listOfObjects);
  </code></pre>
  
  <p>I am getting following exception
  <strong>The number of object passed must be even but was [1]</strong></p>