# Getting a null\_pointer\_exception when executing a distributed multi-term vector query

**URL:** https://discuss.elastic.co/t/getting-a-null-pointer-exception-when-executing-a-distributed-multi-term-vector-query/43606
**Category:** Elasticsearch
**Created:** [March 6, 2016, 8:26pm UTC](https://discuss.elastic.co/t/getting-a-null-pointer-exception-when-executing-a-distributed-multi-term-vector-query/43606 "2016-03-06T20:26:18Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![crjackso](https://avatars.discourse-cdn.com/v4/letter/c/e495f1/32.png) [@crjackso](https://discuss.elastic.co/u/crjackso)
#### Post date: [March 6, 2016, 8:26pm UTC](https://discuss.elastic.co/t/getting-a-null-pointer-exception-when-executing-a-distributed-multi-term-vector-query/43606/1 "2016-03-06T20:26:18Z")

</div>

I'm running the following query on a 3-node ES cluster running ES 2.2.0 on Microsoft Azure. When _dfs_ is set to _true_, I get a null\_pointer\_description (demonstrated below). However, if I set _dfs_ to _false_, I get term vectors. I'd really like to set _dfs_ to _true_ because I'd like to get term statistics for the entire index.

My next step is to try to make sense of the logs on the Azure boxes, but I figured I'd post this question in the meantime in case anything obvious stands out to anybody.

Thanks for your help!

POST [http://url/my\_index/my\_type/\_mtermvectors](http://url/my_index/my_type/_mtermvectors)  
BODY:

```javascript
{  
    "ids" : ["AVM0c1e8FqhBZ7YfiHM8"],
    "parameters": {
        "fields": ["LongDescription"],
        "term_statistics": true,
        "field_statistics": true,
        "dfs": true
    }
}

```

The response I'm getting is:

```javascript
{
  "docs": [
    {
      "_index": "my_index",
      "_type": "my_type",
      "_id": "AVM0c1e8FqhBZ7YfiHM8",
      "error": {
        "root_cause": [
          {
            "type": "exception",
            "reason": "failed to execute term vector request"
          }
        ],
        "type": "exception",
        "reason": "failed to execute term vector request",
        "caused_by": {
          "type": "null_pointer_exception",
          "reason": null
        }
      }
    }
  ]
}

```

---

<div class="post-metadata">

### Author: ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)
#### Post date: [March 8, 2016, 10:21am UTC](https://discuss.elastic.co/t/getting-a-null-pointer-exception-when-executing-a-distributed-multi-term-vector-query/43606/2 "2016-03-08T10:21:46Z")

</div>

Do you happen to have a stack trace in the logs?

---

<div class="post-metadata">

### Author: ![crjackso](https://avatars.discourse-cdn.com/v4/letter/c/e495f1/32.png) [@crjackso](https://discuss.elastic.co/u/crjackso)
#### Post date: [March 8, 2016, 4:21pm UTC](https://discuss.elastic.co/t/getting-a-null-pointer-exception-when-executing-a-distributed-multi-term-vector-query/43606/3 "2016-03-08T16:21:46Z")

</div>

Here's what I was able to pull from the logs:

nested: TooManyClauses[maxClauseCount is set to 1024];  
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:853)  
at org.elasticsearch.search.SearchService.createContext(SearchService.java:652)  
at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:618)  
at org.elasticsearch.search.SearchService.executeDfsPhase(SearchService.java:263)  
at org.elasticsearch.action.termvectors.dfs.TransportDfsOnlyAction.shardOperation(TransportDfsOnlyAction.java:131)  
at org.elasticsearch.action.termvectors.dfs.TransportDfsOnlyAction.shardOperation(TransportDfsOnlyAction.java:54)  
at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:268)  
at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:264)  
at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:350)  
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)  
at java.lang.Thread.run(Thread.java:745)  
Caused by: org.apache.lucene.search.BooleanQuery$TooManyClauses: maxClauseCount is set to 1024  
at org.apache.lucene.search.BooleanQuery$Builder.add(BooleanQuery.java:136)  
at org.apache.lucene.search.BooleanQuery$Builder.add(BooleanQuery.java:124)  
at org.elasticsearch.index.query.BoolQueryParser.parse(BoolQueryParser.java:167)  
at org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:256)  
at org.elasticsearch.index.query.IndexQueryParserService.innerParse(IndexQueryParserService.java:303)  
at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:206)  
at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:201)  
at org.elasticsearch.search.query.QueryParseElement.parse(QueryParseElement.java:33)  
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:836)  
... 12 more  
[2016-03-08 16:16:37,846][DEBUG][action.termvectors] [qwerty-es-kc-c1] [my\_data\_set][0] failed to execute multi term vectors for [document]/[AVM0c1e8FqhBZ7YfiHM8]  
ElasticsearchException[failed to execute term vector request]; nested: NullPointerException;  
at org.elasticsearch.index.termvectors.ShardTermVectorsService.getTermVectors(ShardTermVectorsService.java:152)  
at org.elasticsearch.action.termvectors.TransportShardMultiTermsVectorAction.shardOperation(TransportShardMultiTermsVectorAction.java:84)  
at org.elasticsearch.action.termvectors.TransportShardMultiTermsVectorAction.shardOperation(TransportShardMultiTermsVectorAction.java:40)  
at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:282)  
at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:275)  
at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:350)  
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)  
at java.lang.Thread.run(Thread.java:745)  
Caused by: java.lang.NullPointerException  
at org.elasticsearch.action.termvectors.TermVectorsWriter.writeFieldStatistics(TermVectorsWriter.java:265)  
at org.elasticsearch.action.termvectors.TermVectorsWriter.setFields(TermVectorsWriter.java:86)  
at org.elasticsearch.action.termvectors.TermVectorsResponse.setFields(TermVectorsResponse.java:364)  
at org.elasticsearch.index.termvectors.ShardTermVectorsService.getTermVectors(ShardTermVectorsService.java:149)

---

<div class="post-metadata">

### Author: ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)
#### Post date: [March 8, 2016, 5:22pm UTC](https://discuss.elastic.co/t/getting-a-null-pointer-exception-when-executing-a-distributed-multi-term-vector-query/43606/4 "2016-03-08T17:22:14Z")

</div>

This looks like a bug. Could you open a bug at [https://github.com/elastic/elasticsearch](https://github.com/elastic/elasticsearch) that links to this discussion? Thanks!

---

<div class="post-metadata">

### Author: ![crjackso](https://avatars.discourse-cdn.com/v4/letter/c/e495f1/32.png) [@crjackso](https://discuss.elastic.co/u/crjackso)
#### Post date: [March 8, 2016, 5:39pm UTC](https://discuss.elastic.co/t/getting-a-null-pointer-exception-when-executing-a-distributed-multi-term-vector-query/43606/5 "2016-03-08T17:39:30Z")

</div>

Absolutely. Thanks!

---

<div class="post-metadata">

### Author: ![crjackso](https://avatars.discourse-cdn.com/v4/letter/c/e495f1/32.png) [@crjackso](https://discuss.elastic.co/u/crjackso)
#### Post date: [March 8, 2016, 5:45pm UTC](https://discuss.elastic.co/t/getting-a-null-pointer-exception-when-executing-a-distributed-multi-term-vector-query/43606/6 "2016-03-08T17:45:50Z")

</div>

I created a GitHub issue. You can find it [here](https://github.com/elastic/elasticsearch/issues/17014). Thanks again for the help!

---

<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 5, 2017, 11:10pm UTC](https://discuss.elastic.co/t/getting-a-null-pointer-exception-when-executing-a-distributed-multi-term-vector-query/43606/7 "2017-07-05T23:10:16Z")

</div>


