# Node stats API fails with a Null Pointer exception for data nodes

**URL:** https://discuss.elastic.co/t/node-stats-api-fails-with-a-null-pointer-exception-for-data-nodes/319016
**Category:** Elasticsearch
**Created:** [November 16, 2022, 5:50am UTC](https://discuss.elastic.co/t/node-stats-api-fails-with-a-null-pointer-exception-for-data-nodes/319016 "2022-11-16T05:50:11Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Dheeraj\_Gupta](https://avatars.discourse-cdn.com/v4/letter/d/49beb7/32.png) [@Dheeraj\_Gupta](https://discuss.elastic.co/u/Dheeraj_Gupta)
#### Post date: [November 16, 2022, 5:50am UTC](https://discuss.elastic.co/t/node-stats-api-fails-with-a-null-pointer-exception-for-data-nodes/319016/1 "2022-11-16T05:50:12Z")

</div>

Hi,

We have recently upgraded to 8.5.0 from 8.4.1. We use the node stats API (`_nodes/stats`) to pull stats about various nodes for storage into graphite. Since the update all data nodes are showing the following failure when querying using the API

```auto
curl -XGET http://esmasters:9200/_nodes/7VyrRwY7RsaNsG9Ku_4mHA/stats?pretty
{
  "_nodes" : {
    "total" : 1,
    "successful" : 0,
    "failed" : 1,
    "failures" : [
      {
        "type" : "failed_node_exception",
        "reason" : "Failed node [7VyrRwY7RsaNsG9Ku_4mHA]",
        "node_id" : "7VyrRwY7RsaNsG9Ku_4mHA",
        "caused_by" : {
          "type" : "null_pointer_exception",
          "reason" : "Cannot invoke \"org.elasticsearch.index.mapper.MapperService.mappingLookup()\" because the return value of \"org.elasticsearch.index.IndexService.mapperService()\" is null"
        }
      }
    ]
  },
  "cluster_name" : "my-cluster",
  "nodes" : { }
}

```

I tried restarting the nodes and the API works for some time but then again starts failing with above message. The API for master nodes is working fine. Only the data nodes have this problem.

There are no log messages in the the `server.json` log file related to this error.

Does anybody have any pointers on resolving this?

Thanks

---

<div class="post-metadata">

### Author: ![Dheeraj\_Gupta](https://avatars.discourse-cdn.com/v4/letter/d/49beb7/32.png) [@Dheeraj\_Gupta](https://discuss.elastic.co/u/Dheeraj_Gupta)
#### Post date: [November 16, 2022, 11:15am UTC](https://discuss.elastic.co/t/node-stats-api-fails-with-a-null-pointer-exception-for-data-nodes/319016/2 "2022-11-16T11:15:32Z")

</div>

There is an open issue at [\_nodes/stats returns failed\_node\_exception if closed indices exist · Issue #91259 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/issues/91259) which states this happens if node has closed indices

---

<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: [December 14, 2022, 11:16am UTC](https://discuss.elastic.co/t/node-stats-api-fails-with-a-null-pointer-exception-for-data-nodes/319016/3 "2022-12-14T11:16:27Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
