title: ElasticSearch completion suggester with Java API
body: <p>I had tried a few example codes on suggester feature of ElasticSearch on the net but I couldn't solve my problem against the autocomplete solution</p>
  
  <p>my index:</p>
  
  <pre><code>client.prepareIndex("kodcucom", "article", "1")
        .setSource(putJsonDocument("ElasticSearch: Java",
          "ElasticSeach provides Java API, thus it executes all operations " +
          "asynchronously by using client object..",
           new Date(),
           new String[]{"elasticsearch"},
           "Hüseyin Akdoğan")).execute().actionGet();
  </code></pre>
  
  <p>and I used suggestbuilder to obtain the keyword then scan through the content "field", and here is where the null pointer exception occurs due to no result</p>
  
  <pre><code>CompletionSuggestionBuilder skillNameSuggest = new CompletionSuggestionBuilder("skillNameSuggest");
  
  skillNameSuggest.text("lien");
  skillNameSuggest.field("content");
  
  SuggestRequestBuilder suggestRequestBuilder = client.prepareSuggest("kodcucom").addSuggestion(skillNameSuggest);
  
  SuggestResponse suggestResponse = suggestRequestBuilder.execute().actionGet();
  
  Iterator&lt;? extends Suggest.Suggestion.Entry.Option&gt; iterator =
            suggestResponse.getSuggest().getSuggestion("skillNameSuggest").iterator().next().getOptions().iterator();
  </code></pre>
  
  <p>Am I missing some filters or input criteria in order to get result? Any result should ok such as autocomplete or record found.</p>
  
  <p><strong>EDIT 1:</strong></p>
  
  <p>This is where I got the NPE and I could see that none of any result return at <code>suggestResponse</code>  from debug mode</p>
  
  <pre><code>Iterator&lt;? extends Suggest.Suggestion.Entry.Option&gt; iterator =
                suggestResponse.getSuggest().getSuggestion("skillNameSuggest").iterator().next().getOptions().iterator();
  </code></pre>
  
  <p><strong>EDIT 2:</strong>
  I am using 2.1.1 version of ElasticSearch Java API</p>
  
  <p><strong>EDIT 3:</strong>
  I tried in splitting up the iterator line into several code blocks, the NPE occur at the last line when converting a set of data into iterator, but there is not much helping</p>
  
  <pre><code>Suggest tempSuggest = suggestResponse.getSuggest();
  
  Suggestion tempSuggestion = tempSuggest.getSuggestion("skillNameSuggest");
  
  Iterator tempIterator = tempSuggestion.iterator();
  </code></pre>
  
  <p>I see that the codes:</p>
  
  <pre><code>SuggestRequestBuilder suggestRequestBuilder = client.prepareSuggest("kodcucom").addSuggestion(skillNameSuggest);
  
      SuggestResponse suggestResponse = suggestRequestBuilder.execute().actionGet();
  </code></pre>
  
  <p>has already consists a empty array/dataset, am I using the suggest request builder incorrectly?</p>