# NullPointerException when trying to use Fast Highlighter

**URL:** <https://discuss.elastic.co/t/nullpointerexception-when-trying-to-use-fast-highlighter/5877>\
**Category:** Elasticsearch\
**Created:** [November 15, 2011, 3:48pm UTC](https://discuss.elastic.co/t/nullpointerexception-when-trying-to-use-fast-highlighter/5877 "2011-11-15T15:48:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andy\_3](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@Andy\_3](https://discuss.elastic.co/u/Andy_3)\
**Post date:** [November 15, 2011, 3:48pm UTC](https://discuss.elastic.co/t/nullpointerexception-when-trying-to-use-fast-highlighter/5877/1 "2011-11-15T15:48:49Z")

</div>

I'm new to ElasticSearch. I'm using 0.18.2. I have a 1 node  
cluster, my index has 2 shards and 1 replica.

I have a type, with a mapping with a field like this.

```
			"name": {
				  "type": "string",
				  "boost" : 3.0,
				  "index": "analyzed",
            	                   "store": "yes",
                                       "term_vector":

```

"with\_positions\_offsets"  
}

With the store and term\_vector fields defined, I get a  
NullPointerException and no results returned.

[2011-11-14 22:44:16,984][DEBUG][action.search.type] [Node1]  
[11] Failed to execute fetch phase  
java.lang.NullPointerException  
at  
org.apache.lucene.search.vectorhighlight.CustomFieldQuery.flatten(CustomFieldQuery.java:  
148)  
at  
org.apache.lucene.search.vectorhighlight.CustomFieldQuery.flatten(CustomFieldQuery.java:  
107)  
at  
org.apache.lucene.search.vectorhighlight.FieldQuery.(FieldQuery.java:  
57)  
at  
org.apache.lucene.search.vectorhighlight.CustomFieldQuery.(CustomFieldQuery.java:  
63)  
at  
org.apache.lucene.search.vectorhighlight.CustomFieldQuery.(CustomFieldQuery.java:  
59)  
at  
org.elasticsearch.search.highlight.HighlightPhase.buildFieldQuery(HighlightPhase.java:  
262)  
at  
org.elasticsearch.search.highlight.HighlightPhase.execute(HighlightPhase.java:  
234)  
at  
org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:206)  
at  
org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:  
391)...

If I remove the store and term\_vector fields, highlighting works fine.

Please let me know if you need more information, I can create a curl  
recreation.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [November 15, 2011, 4:10pm UTC](https://discuss.elastic.co/t/nullpointerexception-when-trying-to-use-fast-highlighter/5877/2 "2011-11-15T16:10:49Z")

</div>

Its a bug, found hte problem and will push a fix in master and 0.18, github  
seems to be acting for me, so can't currently open an issue...

On Tue, Nov 15, 2011 at 5:48 PM, Andy [apryor48@gmail.com](mailto:apryor48@gmail.com) wrote:

> I'm new to Elasticsearch. I'm using 0.18.2. I have a 1 node  
> cluster, my index has 2 shards and 1 replica.
> 
> I have a type, with a mapping with a field like this.
> 
> ```
> "name": {
> "type": "string",
> "boost" : 3.0,
> "index": "analyzed",
> "store": "yes",
> "term_vector":
> 
> ```
> 
> "with\_positions\_offsets"  
> }
> 
> With the store and term\_vector fields defined, I get a  
> NullPointerException and no results returned.
> 
> [2011-11-14 22:44:16,984][DEBUG][action.search.type] [Node1]  
> [11] Failed to execute fetch phase  
> java.lang.NullPointerException  
> at
> 
> org.apache.lucene.search.vectorhighlight.CustomFieldQuery.flatten(CustomFieldQuery.java:  
> 148)  
> at
> 
> org.apache.lucene.search.vectorhighlight.CustomFieldQuery.flatten(CustomFieldQuery.java:  
> 107)  
> at  
> org.apache.lucene.search.vectorhighlight.FieldQuery.(FieldQuery.java:  
> 57)  
> at
> 
> org.apache.lucene.search.vectorhighlight.CustomFieldQuery.(CustomFieldQuery.java:  
> 63)  
> at
> 
> org.apache.lucene.search.vectorhighlight.CustomFieldQuery.(CustomFieldQuery.java:  
> 59)  
> at
> 
> org.elasticsearch.search.highlight.HighlightPhase.buildFieldQuery(HighlightPhase.java:  
> 262)  
> at
> 
> org.elasticsearch.search.highlight.HighlightPhase.execute(HighlightPhase.java:  
> 234)  
> at  
> org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:206)  
> at
> 
> org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:  
> 391)...
> 
> If I remove the store and term\_vector fields, highlighting works fine.
> 
> Please let me know if you need more information, I can create a curl  
> recreation.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:48am UTC](https://discuss.elastic.co/t/nullpointerexception-when-trying-to-use-fast-highlighter/5877/3 "2017-07-06T03:48:33Z")

</div>


