diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/all/AllTokenStream.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/all/AllTokenStream.java index 4fabce196b7..86d2e4df23e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/all/AllTokenStream.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/all/AllTokenStream.java @@ -56,11 +56,13 @@ public class AllTokenStream extends TokenFilter { if (!input.incrementToken()) { return false; } - float boost = allEntries.current().boost(); - if (boost != 1.0f) { - payloadAttribute.setPayload(new Payload(encodeFloat(boost))); - } else { - payloadAttribute.setPayload(null); + if (allEntries.current() != null) { + float boost = allEntries.current().boost(); + if (boost != 1.0f) { + payloadAttribute.setPayload(new Payload(encodeFloat(boost))); + } else { + payloadAttribute.setPayload(null); + } } return true; }