CompletionSuggestion.Entry.Option.getPayloadAsMap() throws NPE if no payload is indexed


(Markus Wiesenbacher) #1

Hi,

some of my documents don´t have a payload but some do. If I use following,
I always get a NPE:

        ...
        Iterator<? extends Option> iterator = 

response.getSuggest().iterator().next().getEntries().get(0).iterator();
while (iterator.hasNext()) {

            CompletionSuggestion.Entry.Option completionOption = 

(CompletionSuggestion.Entry.Option)iterator.next();
System.out.println("###: " +
completionOption.getPayloadAsMap()); // in ES v1.1.1
getPayloadAsMap() results in NPE
...

Stacktrace:

java.lang.NullPointerException
at
org.elasticsearch.common.xcontent.XContentFactory.xContent(XContentFactory.java:117)
at
org.elasticsearch.common.xcontent.XContentHelper.convertToMap(XContentHelper.java:116)
at
org.elasticsearch.common.xcontent.XContentHelper.convertToMap(XContentHelper.java:75)
at
org.elasticsearch.search.suggest.completion.CompletionSuggestion$Entry$Option.getPayloadAsMap(CompletionSuggestion.java:105)

Best regards
Markus

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/60f54701-b8e2-4f7c-8802-add7c4121934%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2